@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.umd.js CHANGED
@@ -2210,6 +2210,7 @@
2210
2210
  selectable: false,
2211
2211
  hoverable: false,
2212
2212
  focusable: false,
2213
+ closeOnClick: false,
2213
2214
  },
2214
2215
  maxSelections: 0,
2215
2216
  showRemoveButton: true,
@@ -2256,6 +2257,7 @@
2256
2257
  minDisplayTime: 200,
2257
2258
  contentMode: 'append',
2258
2259
  },
2260
+ searchingMessage: 'Searching...',
2259
2261
  styles: {
2260
2262
  classNames: {},
2261
2263
  },
@@ -2744,6 +2746,7 @@
2744
2746
  :host {
2745
2747
  display: block;
2746
2748
  position: relative;
2749
+ z-index: var(--select-option-z-index, auto);
2747
2750
  font: inherit;
2748
2751
  color: var(--select-option-color, var(--select-text-color, #1f2937));
2749
2752
  background: var(--select-option-bg, var(--select-dropdown-bg, var(--select-bg, white)));
@@ -2806,7 +2809,7 @@
2806
2809
  border-bottom: var(--select-option-disabled-border-bottom, var(--select-option-border-bottom, none));
2807
2810
  opacity: var(--select-option-disabled-opacity, 0.5);
2808
2811
  cursor: var(--select-option-disabled-cursor, not-allowed);
2809
- pointer-events: none;
2812
+ pointer-events: auto;
2810
2813
  }
2811
2814
 
2812
2815
  :host(.smilodon-option--disabled-interactive) {
@@ -2876,7 +2879,7 @@
2876
2879
  border-bottom: inherit;
2877
2880
  opacity: inherit;
2878
2881
  cursor: inherit;
2879
- pointer-events: none;
2882
+ pointer-events: auto;
2880
2883
  }
2881
2884
 
2882
2885
  .option-content {
@@ -2944,6 +2947,15 @@
2944
2947
  pointer-events: none;
2945
2948
  }
2946
2949
 
2950
+ .remove-button-icon > [data-smilodon-fallback-icon],
2951
+ .remove-button-icon > [data-smilodon-react-icon-root] {
2952
+ display: contents;
2953
+ }
2954
+
2955
+ .remove-button-icon[data-smilodon-icon-owner="react"] > [data-smilodon-fallback-icon] {
2956
+ display: none;
2957
+ }
2958
+
2947
2959
  .remove-button-icon svg {
2948
2960
  width: 100%;
2949
2961
  height: 100%;
@@ -2968,6 +2980,7 @@
2968
2980
  selectable: behavior.selectable === true,
2969
2981
  hoverable: behavior.hoverable === true,
2970
2982
  focusable: behavior.focusable === true,
2983
+ closeOnClick: behavior.closeOnClick === true,
2971
2984
  };
2972
2985
  }
2973
2986
  _isDisabledSelectionBlocked() {
@@ -3066,15 +3079,20 @@
3066
3079
  const removeIcon = document.createElement('span');
3067
3080
  removeIcon.className = 'remove-button-icon';
3068
3081
  removeIcon.setAttribute('part', 'chip-remove-icon');
3082
+ const fallbackIcon = document.createElement('span');
3083
+ fallbackIcon.setAttribute('data-smilodon-fallback-icon', '');
3084
+ const portalRoot = document.createElement('span');
3085
+ portalRoot.setAttribute('data-smilodon-react-icon-root', '');
3069
3086
  const iconMarkup = this._config.removeButtonIcon && this._config.removeButtonIcon.trim()
3070
3087
  ? this._config.removeButtonIcon
3071
3088
  : '×';
3072
3089
  if (iconMarkup.trim().startsWith('<')) {
3073
- removeIcon.innerHTML = iconMarkup;
3090
+ fallbackIcon.innerHTML = iconMarkup;
3074
3091
  }
3075
3092
  else {
3076
- removeIcon.textContent = iconMarkup;
3093
+ fallbackIcon.textContent = iconMarkup;
3077
3094
  }
3095
+ removeIcon.append(fallbackIcon, portalRoot);
3078
3096
  this._removeButton.appendChild(removeIcon);
3079
3097
  this._container.appendChild(this._removeButton);
3080
3098
  }
@@ -4340,6 +4358,12 @@
4340
4358
  *
4341
4359
  * Redesigned with formal elegance, refined microinteractions, and polished UX
4342
4360
  */
4361
+ const DROPDOWN_BORDER_LONGHANDS = [
4362
+ 'border-top-width', 'border-right-width', 'border-bottom-width', 'border-left-width',
4363
+ 'border-top-style', 'border-right-style', 'border-bottom-style', 'border-left-style',
4364
+ 'border-top-color', 'border-right-color', 'border-bottom-color', 'border-left-color',
4365
+ 'border-image-source', 'border-image-slice', 'border-image-width', 'border-image-outset', 'border-image-repeat',
4366
+ ];
4343
4367
  const LEGACY_DATA_LOADING_CONFIG = {
4344
4368
  protocol: 'legacy',
4345
4369
  searchMode: 'local',
@@ -4458,6 +4482,8 @@
4458
4482
  this._selectedLabelTooltipResizeObserver = null;
4459
4483
  this._selectedLabelTooltipMeasureFrame = null;
4460
4484
  this._selectedLabelKeys = new WeakMap();
4485
+ this._dropdownConfigInlineStyles = new Map();
4486
+ this._managedLoaderClasses = new Set();
4461
4487
  this._busyPresentationVisible = false;
4462
4488
  this._busyPresentationStartedAt = null;
4463
4489
  this._busyPresentationGeneration = 0;
@@ -4688,9 +4714,11 @@
4688
4714
  this._inputContent = this._createInputContent();
4689
4715
  this._input = this._createInput();
4690
4716
  this._selectedLabelTooltip = this._createSelectedLabelTooltip();
4717
+ this._selectedLabelTooltipTextMeasure = this._createSelectedLabelTooltipTextMeasure();
4691
4718
  this._arrowContainer = this._createArrowContainer();
4692
4719
  this._clearControl = this._createClearControl();
4693
4720
  this._dropdown = this._createDropdown();
4721
+ this._syncDropdownConfigInlineStyles();
4694
4722
  this._optionsContainer = this._createOptionsContainer();
4695
4723
  this._liveRegion = this._createLiveRegion();
4696
4724
  this._errorDescription = this._createErrorDescription();
@@ -4707,6 +4735,9 @@
4707
4735
  }
4708
4736
  connectedCallback() {
4709
4737
  this._hasEverConnected = true;
4738
+ // Adapter capability marker without adding a field to the public class
4739
+ // declaration. React-node remove icons require the isolated root contract.
4740
+ this.setAttribute('data-smilodon-react-icon-portals', 'isolated-v1');
4710
4741
  // register instance
4711
4742
  EnhancedSelect._instances.add(this);
4712
4743
  this._runEngineEffects(this._engine.dispatch({ type: 'CONNECT' }));
@@ -4714,6 +4745,7 @@
4714
4745
  this._connectionController?.abort();
4715
4746
  this._connectionController = new AbortController();
4716
4747
  this._observeSelectedLabelTooltipTargets();
4748
+ this._inputContent.addEventListener('scroll', this._scheduleSelectedLabelTooltipMeasure, { passive: true });
4717
4749
  document.addEventListener('pointerdown', this._onDocumentPointerDown, {
4718
4750
  signal: this._connectionController.signal,
4719
4751
  });
@@ -4797,6 +4829,7 @@
4797
4829
  this._handleClose('disconnect');
4798
4830
  }
4799
4831
  this._runEngineEffects(this._engine.dispatch({ type: 'DISCONNECT' }));
4832
+ this._inputContent.removeEventListener('scroll', this._scheduleSelectedLabelTooltipMeasure);
4800
4833
  this._connectionController?.abort();
4801
4834
  this._connectionController = undefined;
4802
4835
  this._hideSelectedLabelTooltip(true);
@@ -5297,6 +5330,7 @@
5297
5330
  selectable: behavior.selectable === true,
5298
5331
  hoverable: behavior.hoverable === true,
5299
5332
  focusable: behavior.focusable === true,
5333
+ closeOnClick: behavior.closeOnClick === true,
5300
5334
  };
5301
5335
  }
5302
5336
  _isDisabledOptionSelectable(item) {
@@ -5540,6 +5574,7 @@
5540
5574
  const styles = this._config.styles;
5541
5575
  if (!styles)
5542
5576
  return;
5577
+ this._syncLoaderClassNames();
5543
5578
  this._applyStyleVariableMap(styles.option, {
5544
5579
  background: '--select-option-bg',
5545
5580
  backgroundColor: '--select-option-bg',
@@ -5555,6 +5590,7 @@
5555
5590
  fontWeight: '--select-option-font-weight',
5556
5591
  lineHeight: '--select-option-line-height',
5557
5592
  textAlign: '--select-option-text-align',
5593
+ zIndex: '--select-option-z-index',
5558
5594
  });
5559
5595
  this._applyStyleVariableMap(styles.selectedOption, {
5560
5596
  background: '--select-option-selected-bg',
@@ -5708,8 +5744,35 @@
5708
5744
  fontWeight: '--select-group-header-weight',
5709
5745
  textTransform: '--select-group-header-text-transform',
5710
5746
  letterSpacing: '--select-group-header-letter-spacing',
5747
+ position: '--select-group-header-position',
5748
+ top: '--select-group-header-top',
5749
+ zIndex: '--select-group-header-z-index',
5750
+ });
5751
+ this._applyStyleVariableMap(styles.loader, {
5752
+ gap: '--select-loader-gap',
5753
+ padding: '--select-loader-padding',
5754
+ color: '--select-loader-color',
5755
+ background: '--select-loader-bg',
5756
+ backgroundColor: '--select-loader-bg',
5757
+ fontSize: '--select-loader-font-size',
5758
+ textAlign: '--select-loader-text-align',
5759
+ alignItems: '--select-loader-align-items',
5760
+ justifyContent: '--select-loader-justify-content',
5711
5761
  });
5712
5762
  }
5763
+ _syncLoaderClassNames(additionalTarget) {
5764
+ const classNames = new Set((this._config.styles.classNames?.loader ?? '').split(/\s+/).filter(Boolean));
5765
+ const targets = [
5766
+ this._busyBucket,
5767
+ this._optionsContainer?.querySelector('.searching-state'),
5768
+ additionalTarget,
5769
+ ].filter((element) => Boolean(element));
5770
+ for (const target of targets) {
5771
+ target.classList.remove(...this._managedLoaderClasses);
5772
+ target.classList.add(...classNames);
5773
+ }
5774
+ this._managedLoaderClasses = classNames;
5775
+ }
5713
5776
  _resolveDropdownPlacement() {
5714
5777
  const placementMode = this._config.dropdownPlacement?.mode ?? 'bottom';
5715
5778
  if (placementMode === 'bottom' || placementMode === 'top') {
@@ -5737,12 +5800,25 @@
5737
5800
  }
5738
5801
  _setIconContent(target, markup, fallback) {
5739
5802
  const content = markup && markup.trim() ? markup : fallback;
5740
- target.innerHTML = '';
5803
+ let fallbackTarget = target.querySelector(':scope > [data-smilodon-fallback-icon]');
5804
+ if (!fallbackTarget) {
5805
+ fallbackTarget = document.createElement('span');
5806
+ fallbackTarget.setAttribute('data-smilodon-fallback-icon', '');
5807
+ target.prepend(fallbackTarget);
5808
+ }
5809
+ if (!target.querySelector(':scope > [data-smilodon-react-icon-root]')) {
5810
+ const portalRoot = document.createElement('span');
5811
+ portalRoot.setAttribute('data-smilodon-react-icon-root', '');
5812
+ target.append(portalRoot);
5813
+ }
5814
+ // Only Core's fallback subtree is replaceable. React may reconcile a
5815
+ // separate portal root beneath this stable icon target.
5816
+ fallbackTarget.replaceChildren();
5741
5817
  if (content.trim().startsWith('<')) {
5742
- target.innerHTML = content;
5818
+ fallbackTarget.innerHTML = content;
5743
5819
  return;
5744
5820
  }
5745
- target.textContent = content;
5821
+ fallbackTarget.textContent = content;
5746
5822
  }
5747
5823
  _syncInputContainerMode() {
5748
5824
  if (!this._inputContainer || !this._input)
@@ -5965,6 +6041,27 @@
5965
6041
  tooltip.hidden = true;
5966
6042
  return tooltip;
5967
6043
  }
6044
+ _createSelectedLabelTooltipTextMeasure() {
6045
+ const measure = document.createElement('span');
6046
+ measure.setAttribute('aria-hidden', 'true');
6047
+ measure.dataset.selectInternal = 'tooltip-measure';
6048
+ measure.style.cssText = [
6049
+ 'all: initial',
6050
+ 'position: fixed',
6051
+ 'left: -100000px',
6052
+ 'top: 0',
6053
+ 'display: inline-block',
6054
+ 'width: max-content',
6055
+ 'height: auto',
6056
+ 'padding: 0',
6057
+ 'margin: 0',
6058
+ 'border: 0',
6059
+ 'white-space: pre',
6060
+ 'visibility: hidden',
6061
+ 'pointer-events: none',
6062
+ ].join(';');
6063
+ return measure;
6064
+ }
5968
6065
  _createDropdown() {
5969
6066
  const dropdown = document.createElement('div');
5970
6067
  dropdown.className = 'select-dropdown';
@@ -5973,11 +6070,139 @@
5973
6070
  if (this._config.styles.classNames?.dropdown) {
5974
6071
  dropdown.className += ' ' + this._config.styles.classNames.dropdown;
5975
6072
  }
5976
- if (this._config.styles.dropdown) {
5977
- Object.assign(dropdown.style, this._config.styles.dropdown);
5978
- }
5979
6073
  return dropdown;
5980
6074
  }
6075
+ _syncDropdownConfigInlineStyles() {
6076
+ if (!this._dropdown)
6077
+ return;
6078
+ const toCssProperty = (property) => {
6079
+ if (property.startsWith('--'))
6080
+ return property;
6081
+ if (property === 'cssFloat')
6082
+ return 'float';
6083
+ return property.replace(/[A-Z]/g, (character) => `-${character.toLowerCase()}`);
6084
+ };
6085
+ const configured = new Map();
6086
+ for (const [property, value] of Object.entries(this._config.styles.dropdown ?? {})) {
6087
+ if (value === undefined || value === null || String(value).trim() === '')
6088
+ continue;
6089
+ configured.set(toCssProperty(property), String(value));
6090
+ }
6091
+ const style = this._dropdown.style;
6092
+ const readValue = (property) => style.getPropertyValue(property).trim();
6093
+ const readSnapshot = (property) => ({
6094
+ value: readValue(property),
6095
+ priority: style.getPropertyPriority(property),
6096
+ });
6097
+ const sameSnapshot = (left, right) => left.value === right.value && left.priority === right.priority;
6098
+ const readBorderParts = () => new Map(DROPDOWN_BORDER_LONGHANDS.map((part) => [part, readSnapshot(part)]));
6099
+ const restoreValue = (property, value, priority) => {
6100
+ if (value)
6101
+ style.setProperty(property, value, priority);
6102
+ else
6103
+ style.removeProperty(property);
6104
+ };
6105
+ for (const [property, previousOwnership] of this._dropdownConfigInlineStyles) {
6106
+ const currentValue = readValue(property);
6107
+ const currentPriority = style.getPropertyPriority(property);
6108
+ const isStillCoreOwned = currentValue === previousOwnership.appliedValue
6109
+ && currentPriority === previousOwnership.appliedPriority;
6110
+ const previousValue = isStillCoreOwned ? previousOwnership.previousValue : currentValue;
6111
+ const previousPriority = isStillCoreOwned ? previousOwnership.previousPriority : currentPriority;
6112
+ const nextValue = configured.get(property);
6113
+ const relatedBorderParts = previousOwnership.relatedBorderParts;
6114
+ if (nextValue === undefined) {
6115
+ const borderPartRestorations = relatedBorderParts
6116
+ ? [...relatedBorderParts].map(([part, ownership]) => {
6117
+ const current = readSnapshot(part);
6118
+ return [part, sameSnapshot(current, ownership.applied) ? ownership.previous : current];
6119
+ })
6120
+ : [];
6121
+ if (isStillCoreOwned)
6122
+ restoreValue(property, previousValue, previousPriority);
6123
+ for (const [part, restore] of borderPartRestorations) {
6124
+ restoreValue(part, restore.value, restore.priority);
6125
+ }
6126
+ // A shorthand and a longhand can both own the same border components.
6127
+ // When one layer is released, rebase any still-active layer whose saved
6128
+ // baseline came from the released layer's applied value. Otherwise the
6129
+ // final release can resurrect an intermediate Core value instead of
6130
+ // the consumer-authored declaration.
6131
+ if (relatedBorderParts) {
6132
+ for (const [otherProperty, otherOwnership] of this._dropdownConfigInlineStyles) {
6133
+ if (otherProperty === property || !otherOwnership.relatedBorderParts)
6134
+ continue;
6135
+ for (const [part, released] of relatedBorderParts) {
6136
+ const other = otherOwnership.relatedBorderParts.get(part);
6137
+ if (!other)
6138
+ continue;
6139
+ const current = readSnapshot(part);
6140
+ if (sameSnapshot(current, other.applied) && sameSnapshot(other.previous, released.applied)) {
6141
+ otherOwnership.relatedBorderParts.set(part, {
6142
+ ...other,
6143
+ previous: released.previous,
6144
+ });
6145
+ }
6146
+ }
6147
+ }
6148
+ }
6149
+ this._dropdownConfigInlineStyles.delete(property);
6150
+ continue;
6151
+ }
6152
+ const tracksBorderParts = property === 'border' || property === 'border-width';
6153
+ const beforeBorderParts = tracksBorderParts ? readBorderParts() : undefined;
6154
+ style.setProperty(property, nextValue);
6155
+ const afterBorderParts = tracksBorderParts ? readBorderParts() : undefined;
6156
+ let nextRelatedBorderParts;
6157
+ if (beforeBorderParts && afterBorderParts) {
6158
+ nextRelatedBorderParts = new Map();
6159
+ for (const part of DROPDOWN_BORDER_LONGHANDS) {
6160
+ const before = beforeBorderParts.get(part);
6161
+ const after = afterBorderParts.get(part);
6162
+ const previous = relatedBorderParts?.get(part);
6163
+ if (previous || !sameSnapshot(before, after)) {
6164
+ nextRelatedBorderParts.set(part, {
6165
+ previous: previous && sameSnapshot(before, previous.applied) ? previous.previous : before,
6166
+ applied: after,
6167
+ });
6168
+ }
6169
+ }
6170
+ }
6171
+ this._dropdownConfigInlineStyles.set(property, {
6172
+ appliedValue: readValue(property),
6173
+ appliedPriority: style.getPropertyPriority(property),
6174
+ previousValue,
6175
+ previousPriority,
6176
+ ...(nextRelatedBorderParts ? { relatedBorderParts: nextRelatedBorderParts } : {}),
6177
+ });
6178
+ configured.delete(property);
6179
+ }
6180
+ for (const [property, value] of configured) {
6181
+ const previousValue = readValue(property);
6182
+ const previousPriority = style.getPropertyPriority(property);
6183
+ const tracksBorderParts = property === 'border' || property === 'border-width';
6184
+ const beforeBorderParts = tracksBorderParts ? readBorderParts() : undefined;
6185
+ style.setProperty(property, value);
6186
+ const afterBorderParts = tracksBorderParts ? readBorderParts() : undefined;
6187
+ let relatedBorderParts;
6188
+ if (beforeBorderParts && afterBorderParts) {
6189
+ relatedBorderParts = new Map();
6190
+ for (const part of DROPDOWN_BORDER_LONGHANDS) {
6191
+ const before = beforeBorderParts.get(part);
6192
+ const after = afterBorderParts.get(part);
6193
+ if (!sameSnapshot(before, after))
6194
+ relatedBorderParts.set(part, { previous: before, applied: after });
6195
+ }
6196
+ }
6197
+ this._dropdownConfigInlineStyles.set(property, {
6198
+ appliedValue: readValue(property),
6199
+ appliedPriority: style.getPropertyPriority(property),
6200
+ previousValue,
6201
+ previousPriority,
6202
+ ...(relatedBorderParts ? { relatedBorderParts } : {}),
6203
+ });
6204
+ }
6205
+ }
5981
6206
  _createOptionsContainer() {
5982
6207
  const container = document.createElement('div');
5983
6208
  container.className = `options-container ${EnhancedSelect._MIRRORED_STYLES_SCOPE_CLASS}`;
@@ -6060,6 +6285,7 @@
6060
6285
  this._shadow.appendChild(this._errorDescription);
6061
6286
  }
6062
6287
  this._shadow.appendChild(this._selectedLabelTooltip);
6288
+ this._shadow.appendChild(this._selectedLabelTooltipTextMeasure);
6063
6289
  // Set ARIA relationships
6064
6290
  const listboxId = `${this._uniqueId}-listbox`;
6065
6291
  this._dropdown.id = listboxId;
@@ -6244,7 +6470,6 @@
6244
6470
  --select-group-header-separator-border-top: none;
6245
6471
  --select-reduced-motion-duration: 0.01ms;
6246
6472
  --select-reduced-motion-iteration-count: 1;
6247
- --select-high-contrast-border-width: 2px;
6248
6473
  --select-high-contrast-indicator-width: 4px;
6249
6474
  --select-high-contrast-focus-outline-width: 3px;
6250
6475
  --select-high-contrast-focus-outline-color: Highlight;
@@ -6411,6 +6636,15 @@
6411
6636
  pointer-events: none;
6412
6637
  }
6413
6638
 
6639
+ .badge-remove-icon > [data-smilodon-fallback-icon],
6640
+ .badge-remove-icon > [data-smilodon-react-icon-root] {
6641
+ display: contents;
6642
+ }
6643
+
6644
+ .badge-remove-icon[data-smilodon-icon-owner="react"] > [data-smilodon-fallback-icon] {
6645
+ display: none;
6646
+ }
6647
+
6414
6648
  .badge-remove-icon svg {
6415
6649
  width: 100%;
6416
6650
  height: 100%;
@@ -6905,7 +7139,10 @@
6905
7139
  overflow: hidden;
6906
7140
  box-sizing: border-box;
6907
7141
  background: var(--select-dropdown-bg, var(--select-surface));
6908
- border: 1px solid var(--select-dropdown-border, var(--select-border));
7142
+ border:
7143
+ var(--select-dropdown-border-width, 1px)
7144
+ var(--select-dropdown-border-style, solid)
7145
+ var(--select-dropdown-border, var(--select-border));
6909
7146
  border-radius: var(--select-dropdown-border-radius, var(--select-radius-lg));
6910
7147
  box-shadow: var(--select-dropdown-shadow, var(--select-shadow-lg));
6911
7148
  z-index: var(--select-dropdown-z-index, 1000);
@@ -6996,11 +7233,11 @@
6996
7233
  font-size: var(--select-group-header-font-size, 0.7333em);
6997
7234
  text-transform: var(--select-group-header-text-transform, uppercase);
6998
7235
  letter-spacing: var(--select-group-header-letter-spacing, 0.08em);
6999
- position: sticky;
7000
- top: calc(var(--select-options-padding, 6px) * -1);
7236
+ position: var(--select-group-header-position, sticky);
7237
+ top: var(--select-group-header-top, calc(var(--select-options-padding, 6px) * -1));
7001
7238
  left: 0;
7002
7239
  right: 0;
7003
- z-index: 100;
7240
+ z-index: var(--select-group-header-z-index, 100);
7004
7241
  border: var(--select-group-header-border, none);
7005
7242
  border-bottom: var(--select-group-header-border-bottom, 1px solid rgba(0, 0, 0, 0.08));
7006
7243
  border-radius: var(--select-group-header-border-radius, 0);
@@ -7023,6 +7260,7 @@
7023
7260
 
7024
7261
  .option {
7025
7262
  position: relative;
7263
+ z-index: var(--select-option-z-index, auto);
7026
7264
  padding: var(--select-option-padding, 10px 14px);
7027
7265
  cursor: pointer;
7028
7266
  color: var(--select-option-color, var(--select-text));
@@ -7127,7 +7365,7 @@
7127
7365
  border: var(--select-option-disabled-border, var(--select-option-border, none));
7128
7366
  opacity: var(--select-option-disabled-opacity, 0.5);
7129
7367
  cursor: var(--select-option-disabled-cursor, not-allowed);
7130
- pointer-events: var(--select-option-disabled-pointer-events, none);
7368
+ pointer-events: var(--select-option-disabled-pointer-events, auto);
7131
7369
  }
7132
7370
 
7133
7371
  .option.smilodon-option--disabled-interactive {
@@ -7191,14 +7429,14 @@
7191
7429
  .busy-bucket {
7192
7430
  display: flex;
7193
7431
  flex-direction: column;
7194
- align-items: center;
7195
- justify-content: center;
7196
- gap: var(--select-busy-gap, 8px);
7197
- padding: var(--select-busy-padding, 20px);
7198
- text-align: center;
7199
- color: var(--select-busy-color, var(--select-text-muted));
7200
- background: var(--select-busy-bg, transparent);
7201
- font-size: var(--select-busy-font-size, 0.8667em);
7432
+ gap: var(--select-loader-gap, var(--select-busy-gap, 8px));
7433
+ padding: var(--select-loader-padding, var(--select-busy-padding, 20px));
7434
+ text-align: var(--select-loader-text-align, center);
7435
+ color: var(--select-loader-color, var(--select-busy-color, var(--select-text-muted)));
7436
+ background: var(--select-loader-bg, var(--select-busy-bg, transparent));
7437
+ font-size: var(--select-loader-font-size, var(--select-busy-font-size, 0.8667em));
7438
+ align-items: var(--select-loader-align-items, center);
7439
+ justify-content: var(--select-loader-justify-content, center);
7202
7440
  }
7203
7441
 
7204
7442
  .busy-icon {
@@ -7252,26 +7490,27 @@
7252
7490
  }
7253
7491
 
7254
7492
  .searching-state {
7255
- padding: var(--select-searching-padding, 32px 24px);
7256
- text-align: center;
7257
- color: var(--select-searching-color, var(--select-accent));
7258
- font-size: var(--select-searching-font-size, 0.9333em);
7259
- background: var(--select-searching-bg, transparent);
7493
+ padding: var(--select-loader-padding, var(--select-searching-padding, 32px 24px));
7494
+ text-align: var(--select-loader-text-align, center);
7495
+ color: var(--select-loader-color, var(--select-searching-color, var(--select-accent)));
7496
+ font-size: var(--select-loader-font-size, var(--select-searching-font-size, 0.9333em));
7497
+ background: var(--select-loader-bg, var(--select-searching-bg, transparent));
7260
7498
  display: flex;
7261
7499
  flex-direction: column;
7262
- align-items: center;
7263
- justify-content: center;
7264
- gap: var(--select-searching-gap);
7500
+ align-items: var(--select-loader-align-items, center);
7501
+ justify-content: var(--select-loader-justify-content, center);
7502
+ gap: var(--select-loader-gap, var(--select-searching-gap, 8px));
7265
7503
  }
7266
7504
 
7267
- .searching-state::before {
7268
- content: '';
7505
+ .searching-spinner {
7506
+ display: inline-block;
7269
7507
  width: var(--select-searching-spinner-size);
7270
7508
  height: var(--select-searching-spinner-size);
7271
7509
  border: var(--select-searching-spinner-border);
7272
7510
  border-top-color: var(--select-searching-spinner-active-color);
7273
7511
  border-radius: 50%;
7274
7512
  animation: var(--select-searching-spinner-animation);
7513
+ flex: 0 0 auto;
7275
7514
  }
7276
7515
 
7277
7516
  /* ─────────────────────────────────────────────────────────────────────────
@@ -7305,14 +7544,10 @@
7305
7544
  }
7306
7545
  }
7307
7546
 
7308
- @media (prefers-contrast: high) {
7309
- .select-input:focus {
7310
- outline-width: var(--select-high-contrast-focus-outline-width);
7311
- outline-color: var(--select-high-contrast-focus-outline-color);
7312
- }
7313
-
7314
- .input-container {
7315
- border-width: var(--select-high-contrast-border-width);
7547
+ @media (prefers-contrast: more) {
7548
+ .input-container:focus-within {
7549
+ outline: var(--select-high-contrast-focus-outline-width) solid var(--select-high-contrast-focus-outline-color);
7550
+ outline-offset: 2px;
7316
7551
  }
7317
7552
 
7318
7553
  .option.selected::before {
@@ -7404,7 +7639,6 @@
7404
7639
  :host-context([data-theme="dark"]) .input-container,
7405
7640
  :host-context([theme="dark"]) .input-container {
7406
7641
  background: var(--select-surface);
7407
- border-color: var(--select-border);
7408
7642
  }
7409
7643
 
7410
7644
  :host(.dark-mode) .input-container:hover,
@@ -7433,7 +7667,7 @@
7433
7667
  :host-context([darkmode]) .input-container:focus-within,
7434
7668
  :host-context([data-theme="dark"]) .input-container:focus-within,
7435
7669
  :host-context([theme="dark"]) .input-container:focus-within {
7436
- border-color: var(--select-dark-border-focus, var(--select-border-focus, #6366f1));
7670
+ border-color: var(--select-dark-border-focus, var(--select-input-focus-border, var(--select-border-focus, #6366f1)));
7437
7671
  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);
7438
7672
  }
7439
7673
 
@@ -7463,7 +7697,6 @@
7463
7697
  :host-context([data-theme="dark"]) .select-dropdown,
7464
7698
  :host-context([theme="dark"]) .select-dropdown {
7465
7699
  background: var(--select-dropdown-bg, var(--select-surface));
7466
- border-color: var(--select-border);
7467
7700
  }
7468
7701
 
7469
7702
  :host(.dark-mode) .options-container,
@@ -7586,7 +7819,6 @@
7586
7819
  keyboardEvent.stopPropagation();
7587
7820
  this._dismissSelectedLabelTooltip();
7588
7821
  });
7589
- this._inputContent.addEventListener('scroll', this._scheduleSelectedLabelTooltipMeasure, { passive: true });
7590
7822
  // Arrow click handler
7591
7823
  if (this._arrowContainer) {
7592
7824
  this._boundArrowClick = (e) => {
@@ -7599,7 +7831,7 @@
7599
7831
  this._handleClose();
7600
7832
  }
7601
7833
  else if (!this._state.isOpen) {
7602
- this._handleOpen();
7834
+ this._handleOpen('pointer');
7603
7835
  }
7604
7836
  };
7605
7837
  this._arrowContainer.addEventListener('click', this._boundArrowClick);
@@ -7656,7 +7888,7 @@
7656
7888
  }
7657
7889
  const wasClosed = !this._state.isOpen;
7658
7890
  if (wasClosed) {
7659
- this._handleOpen();
7891
+ this._handleOpen('pointer');
7660
7892
  }
7661
7893
  // Focus the input (do not prevent default behavior for input itself)
7662
7894
  this._applyFocusIntent('input', 'input-container-trigger');
@@ -7693,7 +7925,7 @@
7693
7925
  this._suppressNextOpenClick = false;
7694
7926
  this._multiScrollDrag.moved = false;
7695
7927
  if (!this._state.isOpen) {
7696
- this._handleOpen();
7928
+ this._handleOpen('pointer');
7697
7929
  }
7698
7930
  this._applyFocusIntent('input', 'input-container-activation');
7699
7931
  });
@@ -7755,49 +7987,65 @@
7755
7987
  if (!this._config.searchable)
7756
7988
  return;
7757
7989
  const query = e.target.value;
7758
- if (this._selectedLabelTooltipTrigger === this._input
7759
- && this._getSelectedLabelForTrigger(this._input) === null) {
7760
- this._hideSelectedLabelTooltip();
7990
+ if (this._selectedLabelTooltipDismissedTrigger === this._input) {
7991
+ this._selectedLabelTooltipDismissedTrigger = null;
7761
7992
  }
7762
7993
  this._handleSearch(query);
7763
7994
  });
7764
- // If the user presses down inside the options container we should
7765
- // temporarily suppress blur-based closing until after the click has
7766
- // been handled. Setting a flag that gets cleared in the next tick is
7767
- // sufficient.
7768
- this._optionsContainer.addEventListener('pointerdown', () => {
7995
+ const findOptionElement = (event) => {
7996
+ const path = typeof event.composedPath === 'function' ? event.composedPath() : [event.target];
7997
+ for (const node of path) {
7998
+ if (!(node instanceof Element))
7999
+ continue;
8000
+ if (node.matches('select-option[data-sm-index], [data-sm-selectable][data-sm-index], [data-selectable][data-index]')) {
8001
+ return node;
8002
+ }
8003
+ }
8004
+ return null;
8005
+ };
8006
+ const resolveOptionRecord = (event, option = findOptionElement(event)) => {
8007
+ if (!option)
8008
+ return null;
8009
+ const index = Number(option.getAttribute('data-sm-index') ?? option.getAttribute('data-index'));
8010
+ if (!Number.isSafeInteger(index) || index < 0)
8011
+ return null;
8012
+ this._ensureRegistryCurrent();
8013
+ const record = this._getRecordByIndex(index);
8014
+ return record ? { option, record } : null;
8015
+ };
8016
+ // Keep the input focused when a blocked disabled option is pressed. This
8017
+ // prevents the delayed blur-close path from racing the delegated click.
8018
+ this._optionsContainer.addEventListener('pointerdown', (event) => {
7769
8019
  this._suppressBlurClose = true;
7770
8020
  this._setLifecycleTimeout(() => {
7771
8021
  this._suppressBlurClose = false;
7772
8022
  }, 150); // Increased timeout to ensure click finishes before blur checks
8023
+ const option = findOptionElement(event);
8024
+ if (!option?.matches('[aria-disabled="true"], .smilodon-option--disabled, .disabled'))
8025
+ return;
8026
+ const resolved = resolveOptionRecord(event, option);
8027
+ if (!resolved || !resolved.record.disabled)
8028
+ return;
8029
+ if (this._getDisabledOptionBehavior().selectable)
8030
+ return;
8031
+ event.preventDefault();
7773
8032
  });
7774
8033
  // Delegated click listener for improved event handling (robust across shadow DOM)
7775
8034
  const handleOptionEvent = (e) => {
7776
- const path = (e.composedPath && e.composedPath()) || [e.target];
7777
- let option = null;
7778
- for (const node of path) {
7779
- if (!(node instanceof Element))
7780
- continue;
7781
- try {
7782
- if (node.matches('[data-sm-selectable], [data-selectable], [data-sm-state]')) {
7783
- option = node;
7784
- break;
7785
- }
7786
- }
7787
- catch (err) {
7788
- continue;
7789
- }
7790
- }
7791
- if (option && (!option.hasAttribute('aria-disabled') || option.classList.contains('smilodon-option--disabled-selectable'))) {
7792
- const indexStr = option.getAttribute('data-sm-index') ?? option.getAttribute('data-index');
7793
- const index = Number(indexStr);
7794
- if (!Number.isNaN(index)) {
7795
- this._selectOption(index, {
7796
- shiftKey: e.shiftKey,
7797
- toggleKey: e.ctrlKey || e.metaKey,
7798
- });
7799
- }
8035
+ const resolved = resolveOptionRecord(e);
8036
+ if (!resolved)
8037
+ return;
8038
+ const behavior = this._getDisabledOptionBehavior();
8039
+ if (resolved.record.disabled && !behavior.selectable) {
8040
+ e.preventDefault();
8041
+ if (behavior.closeOnClick)
8042
+ this._handleClose('disabled-option-click');
8043
+ return;
7800
8044
  }
8045
+ this._selectOption(resolved.record.index, {
8046
+ shiftKey: e.shiftKey,
8047
+ toggleKey: e.ctrlKey || e.metaKey,
8048
+ });
7801
8049
  };
7802
8050
  this._optionsContainer.addEventListener('click', handleOptionEvent);
7803
8051
  // Keyboard navigation
@@ -7934,7 +8182,7 @@
7934
8182
  _getSelectedLabelForTrigger(trigger) {
7935
8183
  const entries = this._getSelectedEntries();
7936
8184
  if (trigger === this._input) {
7937
- if (this._config.selection.mode !== 'single' || this._state.searchQuery.length > 0)
8185
+ if (this._config.selection.mode !== 'single')
7938
8186
  return null;
7939
8187
  const item = entries[0]?.item;
7940
8188
  if (item === undefined)
@@ -7958,6 +8206,57 @@
7958
8206
  return false;
7959
8207
  return trigger.clientWidth > 0 && trigger.scrollWidth > trigger.clientWidth + 1;
7960
8208
  }
8209
+ _getSelectedLabelTooltipContent(trigger) {
8210
+ if (trigger === this._input && this._config.searchable) {
8211
+ const visibleText = this._input.value;
8212
+ const pendingQuery = this._acknowledgedPendingSearchQuery;
8213
+ const committedQuery = this._state.searchQuery;
8214
+ const isPendingQuery = pendingQuery !== null && pendingQuery.length > 0 && visibleText === pendingQuery;
8215
+ const isCommittedQuery = committedQuery.length > 0 && visibleText === committedQuery;
8216
+ if (visibleText.length > 0 && (isPendingQuery || isCommittedQuery)) {
8217
+ return { kind: 'search-query', text: visibleText };
8218
+ }
8219
+ }
8220
+ const selectedLabel = this._getSelectedLabelForTrigger(trigger);
8221
+ return selectedLabel === null ? null : { kind: 'selected-label', text: selectedLabel };
8222
+ }
8223
+ _isSelectedLabelTooltipContentTruncated(trigger, content) {
8224
+ if (trigger !== this._input)
8225
+ return this._isSelectedLabelTruncated(trigger);
8226
+ if (!trigger.isConnected || !content.text)
8227
+ return false;
8228
+ const style = getComputedStyle(this._input);
8229
+ const measure = this._selectedLabelTooltipTextMeasure;
8230
+ measure.textContent = content.text;
8231
+ const mirroredProperties = [
8232
+ 'font',
8233
+ 'font-family',
8234
+ 'font-size',
8235
+ 'font-style',
8236
+ 'font-weight',
8237
+ 'font-stretch',
8238
+ 'font-variant',
8239
+ 'font-kerning',
8240
+ 'font-feature-settings',
8241
+ 'font-variation-settings',
8242
+ 'letter-spacing',
8243
+ 'word-spacing',
8244
+ 'text-transform',
8245
+ 'direction',
8246
+ 'unicode-bidi',
8247
+ ];
8248
+ for (const property of mirroredProperties) {
8249
+ const value = style.getPropertyValue(property);
8250
+ if (value)
8251
+ measure.style.setProperty(property, value);
8252
+ }
8253
+ const contentWidth = measure.getBoundingClientRect().width;
8254
+ const inputStyle = style;
8255
+ const horizontalPadding = Number.parseFloat(inputStyle.paddingLeft) + Number.parseFloat(inputStyle.paddingRight);
8256
+ const textIndent = Number.parseFloat(inputStyle.textIndent) || 0;
8257
+ const availableWidth = this._input.clientWidth - (Number.isFinite(horizontalPadding) ? horizontalPadding : 0) - textIndent;
8258
+ return availableWidth > 0 && contentWidth > availableWidth + 1;
8259
+ }
7961
8260
  _handleSelectedLabelPointerOver(event) {
7962
8261
  const target = event.target;
7963
8262
  if (target?.closest('.selected-label-tooltip') === this._selectedLabelTooltip) {
@@ -8023,8 +8322,8 @@
8023
8322
  this._hideSelectedLabelTooltip();
8024
8323
  return;
8025
8324
  }
8026
- const label = this._getSelectedLabelForTrigger(trigger);
8027
- if (label === null || !this._isSelectedLabelTruncated(trigger)) {
8325
+ const content = this._getSelectedLabelTooltipContent(trigger);
8326
+ if (content === null || !this._isSelectedLabelTooltipContentTruncated(trigger, content)) {
8028
8327
  if (trigger.classList.contains('selection-badge-label'))
8029
8328
  trigger.tabIndex = -1;
8030
8329
  if (this._selectedLabelTooltipTrigger === trigger)
@@ -8037,7 +8336,7 @@
8037
8336
  this._removeSelectedLabelTooltipDescription(this._selectedLabelTooltipTrigger);
8038
8337
  this._selectedLabelTooltipTrigger = trigger;
8039
8338
  }
8040
- this._selectedLabelTooltip.textContent = label;
8339
+ this._selectedLabelTooltip.textContent = content.text;
8041
8340
  this._selectedLabelTooltip.hidden = false;
8042
8341
  this._positionSelectedLabelTooltip(trigger);
8043
8342
  this._syncSelectedLabelTooltipDescription();
@@ -8091,6 +8390,7 @@
8091
8390
  this._removeSelectedLabelTooltipDescription(this._selectedLabelTooltipTrigger);
8092
8391
  this._selectedLabelTooltipTrigger = null;
8093
8392
  this._selectedLabelTooltip.hidden = true;
8393
+ this._selectedLabelTooltipTextMeasure.textContent = '';
8094
8394
  if (clearInteractionState) {
8095
8395
  this._selectedLabelTooltipPointerTrigger = null;
8096
8396
  this._selectedLabelTooltipFocusTrigger = null;
@@ -8148,10 +8448,12 @@
8148
8448
  return;
8149
8449
  const hasSingleSelection = this._config.selection.mode === 'single'
8150
8450
  && this._getSelectedEntries().length > 0;
8451
+ const inputContent = this._getSelectedLabelTooltipContent(this._input);
8452
+ const shouldObserveInput = hasSingleSelection || inputContent?.kind === 'search-query';
8151
8453
  const chipLabels = this._getActiveChipBadges()
8152
8454
  .map((badge) => badge.querySelector('.selection-badge-label'))
8153
8455
  .filter((label) => label !== null);
8154
- if (!hasSingleSelection && chipLabels.length === 0) {
8456
+ if (!shouldObserveInput && chipLabels.length === 0) {
8155
8457
  this._selectedLabelTooltipResizeObserver?.disconnect();
8156
8458
  this._selectedLabelTooltipResizeObserver = null;
8157
8459
  return;
@@ -8160,7 +8462,7 @@
8160
8462
  this._selectedLabelTooltipResizeObserver = new ResizeObserver(() => this._scheduleSelectedLabelTooltipMeasure());
8161
8463
  }
8162
8464
  this._selectedLabelTooltipResizeObserver.disconnect();
8163
- if (hasSingleSelection)
8465
+ if (shouldObserveInput)
8164
8466
  this._selectedLabelTooltipResizeObserver.observe(this._input);
8165
8467
  chipLabels.forEach((label) => {
8166
8468
  this._selectedLabelTooltipResizeObserver?.observe(label);
@@ -8194,8 +8496,8 @@
8194
8496
  this._hideSelectedLabelTooltip();
8195
8497
  return;
8196
8498
  }
8197
- const label = this._getSelectedLabelForTrigger(trigger);
8198
- if (label === null || !this._isSelectedLabelTruncated(trigger)) {
8499
+ const content = this._getSelectedLabelTooltipContent(trigger);
8500
+ if (content === null || !this._isSelectedLabelTooltipContentTruncated(trigger, content)) {
8199
8501
  if (this._selectedLabelTooltipTrigger === trigger)
8200
8502
  this._hideSelectedLabelTooltip();
8201
8503
  return;
@@ -8257,7 +8559,7 @@
8257
8559
  },
8258
8560
  }, { applyFocus: true });
8259
8561
  }
8260
- _handleOpen() {
8562
+ _handleOpen(intent = 'default') {
8261
8563
  if (!this._config.enabled) {
8262
8564
  this._runEngineEffects(this._engine.dispatch({ type: 'DISABLED_CHANGED', disabled: true }));
8263
8565
  return;
@@ -8291,10 +8593,17 @@
8291
8593
  this._liftStackingAncestors();
8292
8594
  this._dropdown.style.display = 'block';
8293
8595
  this._updateArrowRotation();
8596
+ // Pointer opening must not turn the previous selection or stale active key
8597
+ // into a synthetic hover-like highlight. Clear engine identity before the
8598
+ // options are rendered so built-in and custom renderers share the same state.
8599
+ if (intent === 'pointer') {
8600
+ this._dispatchActiveKey(null, 'open', 'pointer dropdown open');
8601
+ }
8294
8602
  // Render options when opening
8295
8603
  this._renderOptions();
8296
8604
  this._syncDropdownPlacement();
8297
- this._setInitialActiveOption();
8605
+ if (intent !== 'pointer')
8606
+ this._setInitialActiveOption();
8298
8607
  this._emit('open', {});
8299
8608
  this._config.callbacks.onOpen?.();
8300
8609
  this._announce('Options expanded');
@@ -8797,10 +9106,8 @@
8797
9106
  return results;
8798
9107
  }
8799
9108
  _handleSearch(query) {
8800
- if (this._selectedLabelTooltipTrigger === this._input
8801
- && (query.length > 0 || this._getSelectedLabelForTrigger(this._input) === null)) {
8802
- this._hideSelectedLabelTooltip();
8803
- }
9109
+ const previousQuery = this._acknowledgedPendingSearchQuery ?? this._state.searchQuery;
9110
+ const queryPresenceChanged = Boolean(previousQuery) !== Boolean(query);
8804
9111
  if (this._dataRequestCoordinator
8805
9112
  && (this._acknowledgedProjectionPending || this._acknowledgedProjectionSettling)) {
8806
9113
  // Keep the committed query/generation stable until the accepted snapshot
@@ -8809,6 +9116,9 @@
8809
9116
  this._acknowledgedPendingSearchQuery = query;
8810
9117
  this._input.value = query;
8811
9118
  this._syncClearControlState();
9119
+ if (queryPresenceChanged)
9120
+ this._observeSelectedLabelTooltipTargets();
9121
+ this._refreshSelectedLabelTooltipMeasurements();
8812
9122
  return;
8813
9123
  }
8814
9124
  if (this._dataLoadingConfig.protocol === 'acknowledged'
@@ -8820,6 +9130,9 @@
8820
9130
  this._cancelBusyPresentation();
8821
9131
  this._state.searchQuery = query;
8822
9132
  this._syncClearControlState();
9133
+ if (queryPresenceChanged)
9134
+ this._observeSelectedLabelTooltipTargets();
9135
+ this._refreshSelectedLabelTooltipMeasurements();
8823
9136
  this._state.lastNotifiedQuery = query;
8824
9137
  this._state.lastNotifiedResultCount = 0;
8825
9138
  if (this._dataRequestCoordinator) {
@@ -8858,6 +9171,9 @@
8858
9171
  }
8859
9172
  this._state.searchQuery = query;
8860
9173
  this._syncClearControlState();
9174
+ if (queryPresenceChanged)
9175
+ this._observeSelectedLabelTooltipTargets();
9176
+ this._refreshSelectedLabelTooltipMeasurements();
8861
9177
  if (this._dataLoadingConfig.protocol === 'acknowledged' && this._dataRequestCoordinator) {
8862
9178
  // Local acknowledged search has no remote request, but pagination still
8863
9179
  // belongs to the coordinator's current query generation.
@@ -9372,7 +9688,7 @@
9372
9688
  const selectableIndices = this._getSelectableOptionIndices();
9373
9689
  const selected = Array.from(this._state.selectedIndices).sort((a, b) => a - b);
9374
9690
  // Opening an empty select must not implicitly assign an active descendant.
9375
- // Keyboard navigation and pointer interaction establish active identity.
9691
+ // Keyboard navigation and option interaction establish active identity.
9376
9692
  if (selectableIndices.length === 0 || selected.length === 0) {
9377
9693
  this._dispatchActiveKey(null, 'open', 'initial active option');
9378
9694
  return;
@@ -9583,6 +9899,7 @@
9583
9899
  this._chipElements.delete(key);
9584
9900
  expected.remove();
9585
9901
  if (this.isConnected) {
9902
+ this._syncMultiSelectPlaceholderVisibility();
9586
9903
  this._observeSelectedLabelTooltipTargets();
9587
9904
  this._refreshSelectedLabelTooltipMeasurements();
9588
9905
  }
@@ -9752,6 +10069,21 @@
9752
10069
  nextSibling = badge;
9753
10070
  }
9754
10071
  }
10072
+ this._syncMultiSelectPlaceholderVisibility();
10073
+ }
10074
+ _syncMultiSelectPlaceholderVisibility() {
10075
+ if (this._config.selection.mode !== 'multi')
10076
+ return;
10077
+ const hasLogicalSelection = this._getSelectedEntries().length > 0;
10078
+ const hasMountedChipPresentation = this._inputContent.querySelector('.selection-badge') !== null;
10079
+ const isEmpty = !hasLogicalSelection && !hasMountedChipPresentation;
10080
+ this._input.placeholder = isEmpty
10081
+ ? (this._config.placeholder || 'Select an option...')
10082
+ : '';
10083
+ if (isEmpty
10084
+ && (this._config.multiSelectDisplay?.mode ?? 'wrap') === 'horizontal') {
10085
+ this._inputContent.scrollLeft = 0;
10086
+ }
9755
10087
  }
9756
10088
  _updateInputDisplay() {
9757
10089
  const selectedEntries = this._getSelectedEntries();
@@ -9780,14 +10112,8 @@
9780
10112
  this._cancelLatestChipScroll();
9781
10113
  const getLabel = this._config.serverSide.getLabelFromItem || ((item) => item?.label ?? String(item));
9782
10114
  if (this._config.selection.mode === 'multi') {
9783
- if (selectedItems.length === 0) {
9784
- this._input.value = '';
9785
- this._input.placeholder = this._config.placeholder || 'Select an option...';
9786
- }
9787
- else {
9788
- this._input.value = '';
9789
- this._input.placeholder = '';
9790
- }
10115
+ this._input.value = '';
10116
+ this._input.placeholder = '';
9791
10117
  this._renderSelectedChips(selectedEntries);
9792
10118
  }
9793
10119
  else {
@@ -9809,7 +10135,10 @@
9809
10135
  }
9810
10136
  // Preserve manual scrolling. Only a newly selected key can request auto-scroll.
9811
10137
  if (this._config.selection.mode === 'multi') {
9812
- this._inputContent.scrollLeft = previousChipScrollLeft;
10138
+ const hasMountedChipPresentation = this._inputContent.querySelector('.selection-badge') !== null;
10139
+ this._inputContent.scrollLeft = selectedEntries.length === 0 && !hasMountedChipPresentation
10140
+ ? 0
10141
+ : previousChipScrollLeft;
9813
10142
  if (newlyAddedKey !== undefined)
9814
10143
  this._scheduleLatestChipScroll(newlyAddedKey);
9815
10144
  }
@@ -10480,6 +10809,8 @@
10480
10809
  }
10481
10810
  this._renderOptions();
10482
10811
  this._syncClearControlState();
10812
+ this._observeSelectedLabelTooltipTargets();
10813
+ this._refreshSelectedLabelTooltipMeasurements();
10483
10814
  }
10484
10815
  /**
10485
10816
  * Open dropdown
@@ -10595,7 +10926,10 @@
10595
10926
  if (this._input) {
10596
10927
  this._input.readOnly = !this._config.searchable;
10597
10928
  this._syncComboboxAccessibility();
10598
- if (this._state.selectedIndices.size === 0) {
10929
+ if (this._config.selection.mode === 'multi') {
10930
+ this._syncMultiSelectPlaceholderVisibility();
10931
+ }
10932
+ else if (this._state.selectedIndices.size === 0) {
10599
10933
  this._input.placeholder = this._config.placeholder || 'Select an option...';
10600
10934
  }
10601
10935
  }
@@ -10612,6 +10946,7 @@
10612
10946
  }
10613
10947
  }
10614
10948
  this._syncStyleConfigVariables();
10949
+ this._syncDropdownConfigInlineStyles();
10615
10950
  this._syncListboxAccessibility();
10616
10951
  if (this.isConnected) {
10617
10952
  this._syncDirectionConfig();
@@ -10688,6 +11023,8 @@
10688
11023
  }
10689
11024
  }
10690
11025
  }
11026
+ this._observeSelectedLabelTooltipTargets();
11027
+ this._refreshSelectedLabelTooltipMeasurements();
10691
11028
  if (configErrorDetail) {
10692
11029
  this._emit('dataLoadingConfigError', configErrorDetail);
10693
11030
  try {
@@ -11975,8 +12312,12 @@
11975
12312
  _createBusyBucket() {
11976
12313
  const bucket = document.createElement('div');
11977
12314
  bucket.setAttribute('part', 'loading');
12315
+ bucket.setAttribute('role', 'status');
12316
+ bucket.setAttribute('aria-live', 'polite');
12317
+ bucket.setAttribute('aria-atomic', 'true');
11978
12318
  bucket.className = 'busy-bucket';
11979
12319
  this._busyBucket = bucket;
12320
+ this._syncLoaderClassNames();
11980
12321
  const icon = document.createElement('div');
11981
12322
  icon.className = 'busy-icon';
11982
12323
  icon.setAttribute('part', 'loading-icon');
@@ -12024,6 +12365,25 @@
12024
12365
  this._syncBusyBucketContent(bucket);
12025
12366
  return bucket;
12026
12367
  }
12368
+ _createSearchingState() {
12369
+ const searching = document.createElement('div');
12370
+ searching.className = 'searching-state';
12371
+ searching.setAttribute('part', 'loading searching');
12372
+ searching.setAttribute('role', 'status');
12373
+ searching.setAttribute('aria-live', 'polite');
12374
+ searching.setAttribute('aria-atomic', 'true');
12375
+ const spinner = document.createElement('span');
12376
+ spinner.className = 'searching-spinner';
12377
+ spinner.setAttribute('part', 'searching-spinner');
12378
+ spinner.setAttribute('aria-hidden', 'true');
12379
+ const message = document.createElement('span');
12380
+ message.className = 'searching-message';
12381
+ message.setAttribute('part', 'searching-message');
12382
+ message.textContent = this._config.searchingMessage ?? 'Searching...';
12383
+ searching.append(spinner, message);
12384
+ this._syncLoaderClassNames(searching);
12385
+ return searching;
12386
+ }
12027
12387
  _renderOptions() {
12028
12388
  this._syncBusyPresentation();
12029
12389
  this._clearBusyBucketContentObserver();
@@ -12066,10 +12426,7 @@
12066
12426
  this._renderPlan = this._createLegacyRenderPlan([]);
12067
12427
  this._refreshVirtualizationScope(filteredIndicesForScope);
12068
12428
  this._syncLegacyActiveAria();
12069
- const searching = document.createElement('div');
12070
- searching.className = 'searching-state';
12071
- searching.setAttribute('part', 'loading');
12072
- searching.textContent = 'Searching...';
12429
+ const searching = this._createSearchingState();
12073
12430
  this._optionsContainer.appendChild(searching);
12074
12431
  this._syncEmptyStateContext(null);
12075
12432
  this._resolveRenderCycle(renderCycleId, true);
@@ -12549,6 +12906,7 @@
12549
12906
  _addLoadMoreTrigger() {
12550
12907
  const container = document.createElement('div');
12551
12908
  container.className = 'load-more-container';
12909
+ container.setAttribute('part', 'load-more-container');
12552
12910
  if (this._dataRequestCoordinator) {
12553
12911
  const shouldObserve = this._config.infiniteScroll.enabled
12554
12912
  && Boolean(this._intersectionObserver)
@@ -12560,6 +12918,7 @@
12560
12918
  sentinel.style.height = '10px';
12561
12919
  sentinel.style.width = '100%';
12562
12920
  sentinel.style.opacity = '0';
12921
+ sentinel.setAttribute('aria-hidden', 'true');
12563
12922
  this._acknowledgedSentinel = sentinel;
12564
12923
  this._loadMoreTrigger = sentinel;
12565
12924
  container.appendChild(sentinel);
@@ -12569,7 +12928,8 @@
12569
12928
  if (this._config.loadMore.enabled || this._config.infiniteScroll.enabled) {
12570
12929
  const button = document.createElement('button');
12571
12930
  button.className = 'load-more-button';
12572
- button.textContent = `Load ${this._config.loadMore.itemsPerLoad} more`;
12931
+ button.setAttribute('part', 'load-more-button');
12932
+ button.textContent = this._config.loadMore.label ?? `Load ${this._config.loadMore.itemsPerLoad} more`;
12573
12933
  button.addEventListener('click', () => this._loadMoreItems('manual'));
12574
12934
  container.appendChild(button);
12575
12935
  if (!sentinel)
@@ -12597,6 +12957,7 @@
12597
12957
  sentinel.style.height = '10px';
12598
12958
  sentinel.style.width = '100%';
12599
12959
  sentinel.style.opacity = '0'; // Invisible
12960
+ sentinel.setAttribute('aria-hidden', 'true');
12600
12961
  this._loadMoreTrigger = sentinel;
12601
12962
  container.appendChild(sentinel);
12602
12963
  }
@@ -12604,7 +12965,8 @@
12604
12965
  // Manual Load More: Render a button
12605
12966
  const button = document.createElement('button');
12606
12967
  button.className = 'load-more-button';
12607
- button.textContent = `Load ${this._config.loadMore.itemsPerLoad} more`;
12968
+ button.setAttribute('part', 'load-more-button');
12969
+ button.textContent = this._config.loadMore.label ?? `Load ${this._config.loadMore.itemsPerLoad} more`;
12608
12970
  button.addEventListener('click', () => this._loadMoreItems());
12609
12971
  this._loadMoreTrigger = button;
12610
12972
  container.appendChild(button);