@smilodon/core 1.4.13 → 1.5.1

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
@@ -1354,9 +1354,21 @@
1354
1354
  allowDeselect: false,
1355
1355
  maxSelections: 0,
1356
1356
  showRemoveButton: true,
1357
+ removeButtonIcon: '×',
1357
1358
  closeOnSelect: true,
1358
1359
  toggleOnTriggerClick: true,
1359
1360
  },
1361
+ direction: 'ltr',
1362
+ dropdownPlacement: {
1363
+ mode: 'bottom',
1364
+ },
1365
+ multiSelectDisplay: {
1366
+ mode: 'wrap',
1367
+ maxHeight: '160px',
1368
+ overflowX: 'hidden',
1369
+ overflowY: 'auto',
1370
+ dragScroll: true,
1371
+ },
1360
1372
  scrollToSelected: {
1361
1373
  enabled: true,
1362
1374
  multiSelectTarget: 'first',
@@ -1517,6 +1529,8 @@
1517
1529
  :host {
1518
1530
  display: block;
1519
1531
  position: relative;
1532
+ font: inherit;
1533
+ color: inherit;
1520
1534
  }
1521
1535
 
1522
1536
  /* Allow authors to style selected state from outside the shadow root
@@ -1548,7 +1562,7 @@
1548
1562
  display: flex;
1549
1563
  align-items: center;
1550
1564
  justify-content: space-between;
1551
- padding: var(--select-option-padding, 8px 12px);
1565
+ padding: var(--select-option-padding, 10px 14px);
1552
1566
  cursor: pointer;
1553
1567
  user-select: none;
1554
1568
  color: var(--select-option-color, var(--select-text-color, #1f2937));
@@ -1556,13 +1570,19 @@
1556
1570
  transition: var(--select-option-transition, background-color 0.2s ease);
1557
1571
  border: var(--select-option-border, none);
1558
1572
  border-bottom: var(--select-option-border-bottom, none);
1559
- border-radius: var(--select-option-border-radius, 0);
1573
+ border-radius: var(--select-option-border-radius, var(--select-radius-sm, 6px));
1560
1574
  box-shadow: var(--select-option-shadow, none);
1561
1575
  transform: var(--select-option-transform, none);
1576
+ font: inherit;
1562
1577
  }
1563
1578
 
1564
1579
  .option-container:hover {
1565
1580
  background: var(--select-option-hover-bg, #f0f0f0);
1581
+ color: var(--select-option-hover-color, var(--select-option-color, var(--select-text-color, #1f2937)));
1582
+ border: var(--select-option-hover-border, var(--select-option-border, none));
1583
+ border-bottom: var(--select-option-hover-border-bottom, var(--select-option-border-bottom, none));
1584
+ box-shadow: var(--select-option-hover-shadow, var(--select-option-shadow, none));
1585
+ transform: var(--select-option-hover-transform, var(--select-option-transform, none));
1566
1586
  }
1567
1587
 
1568
1588
  .option-container.selected {
@@ -1585,13 +1605,22 @@
1585
1605
  }
1586
1606
 
1587
1607
  .option-container.active {
1588
- outline: 2px solid var(--select-option-active-outline, #1976d2);
1589
- outline-offset: -2px;
1608
+ background: var(--select-option-active-bg, var(--select-option-hover-bg, #f0f0f0));
1609
+ color: var(--select-option-active-color, var(--select-option-hover-color, var(--select-option-color, var(--select-text-color, #1f2937))));
1610
+ border: var(--select-option-active-border, var(--select-option-hover-border, var(--select-option-border, none)));
1611
+ box-shadow: var(--select-option-active-shadow, var(--select-option-shadow, none));
1612
+ transform: var(--select-option-active-transform, var(--select-option-transform, none));
1613
+ outline: var(--select-option-active-outline, 2px solid #1976d2);
1614
+ outline-offset: var(--select-option-active-outline-offset, -2px);
1590
1615
  }
1591
1616
 
1592
1617
  .option-container.disabled {
1593
- opacity: 0.5;
1594
- cursor: not-allowed;
1618
+ background: var(--select-option-disabled-bg, var(--select-option-bg, var(--select-dropdown-bg, var(--select-bg, white))));
1619
+ color: var(--select-option-disabled-color, var(--select-option-color, var(--select-text-color, #1f2937)));
1620
+ border: var(--select-option-disabled-border, var(--select-option-border, none));
1621
+ border-bottom: var(--select-option-disabled-border-bottom, var(--select-option-border-bottom, none));
1622
+ opacity: var(--select-option-disabled-opacity, 0.5);
1623
+ cursor: var(--select-option-disabled-cursor, not-allowed);
1595
1624
  pointer-events: none;
1596
1625
  }
1597
1626
 
@@ -1608,6 +1637,12 @@
1608
1637
  color: var(--select-checkmark-color, currentColor);
1609
1638
  }
1610
1639
 
1640
+ :host([dir="rtl"]) .checkmark-icon,
1641
+ :host-context([dir="rtl"]) .checkmark-icon {
1642
+ margin-left: 0;
1643
+ margin-right: var(--select-checkmark-margin-left, 8px);
1644
+ }
1645
+
1611
1646
  :host([aria-selected="true"]) .checkmark-icon,
1612
1647
  .option-container.selected .checkmark-icon {
1613
1648
  display: inline-flex;
@@ -1615,20 +1650,49 @@
1615
1650
 
1616
1651
  .remove-button {
1617
1652
  margin-left: 8px;
1618
- padding: 2px 6px;
1653
+ width: var(--select-badge-remove-size, 18px);
1654
+ height: var(--select-badge-remove-size, 18px);
1655
+ min-width: var(--select-badge-remove-min-width, var(--select-badge-remove-size, 18px));
1656
+ min-height: var(--select-badge-remove-min-height, var(--select-badge-remove-size, 18px));
1657
+ padding: 0;
1619
1658
  border: none;
1620
- background-color: var(--select-remove-btn-bg, transparent);
1621
- color: var(--select-remove-btn-color, #666);
1659
+ background-color: var(--select-badge-remove-bg, rgba(255, 255, 255, 0.2));
1660
+ color: var(--select-badge-remove-color, currentColor);
1622
1661
  cursor: pointer;
1623
- border-radius: 3px;
1624
- font-size: 16px;
1662
+ border-radius: var(--select-badge-remove-radius, 50%);
1663
+ font-size: var(--select-badge-remove-font-size, 0.7333em);
1664
+ font-weight: var(--select-badge-remove-font-weight, 600);
1625
1665
  line-height: 1;
1666
+ display: inline-flex;
1667
+ align-items: center;
1668
+ justify-content: center;
1626
1669
  transition: all 0.2s ease;
1627
1670
  }
1671
+
1672
+ :host([dir="rtl"]) .remove-button,
1673
+ :host-context([dir="rtl"]) .remove-button {
1674
+ margin-left: 0;
1675
+ margin-right: 8px;
1676
+ }
1677
+
1678
+ .remove-button-icon {
1679
+ display: inline-flex;
1680
+ align-items: center;
1681
+ justify-content: center;
1682
+ width: var(--select-badge-remove-icon-size, 10px);
1683
+ height: var(--select-badge-remove-icon-size, 10px);
1684
+ pointer-events: none;
1685
+ }
1686
+
1687
+ .remove-button-icon svg {
1688
+ width: 100%;
1689
+ height: 100%;
1690
+ display: block;
1691
+ }
1628
1692
 
1629
1693
  .remove-button:hover {
1630
- background-color: var(--select-remove-btn-hover-bg, #ffebee);
1631
- color: var(--select-remove-btn-hover-color, #c62828);
1694
+ background-color: var(--select-badge-remove-hover-bg, #ffebee);
1695
+ color: var(--select-badge-remove-hover-color, #c62828);
1632
1696
  }
1633
1697
 
1634
1698
  .remove-button:focus {
@@ -1715,10 +1779,22 @@
1715
1779
  if (showRemoveButton && selected) {
1716
1780
  this._removeButton = document.createElement('button');
1717
1781
  this._removeButton.className = 'remove-button';
1718
- this._removeButton.innerHTML = '×';
1719
1782
  this._removeButton.setAttribute('part', 'chip-remove');
1720
1783
  this._removeButton.setAttribute('aria-label', 'Remove option');
1721
1784
  this._removeButton.setAttribute('type', 'button');
1785
+ const removeIcon = document.createElement('span');
1786
+ removeIcon.className = 'remove-button-icon';
1787
+ removeIcon.setAttribute('part', 'chip-remove-icon');
1788
+ const iconMarkup = this._config.removeButtonIcon && this._config.removeButtonIcon.trim()
1789
+ ? this._config.removeButtonIcon
1790
+ : '×';
1791
+ if (iconMarkup.trim().startsWith('<')) {
1792
+ removeIcon.innerHTML = iconMarkup;
1793
+ }
1794
+ else {
1795
+ removeIcon.textContent = iconMarkup;
1796
+ }
1797
+ this._removeButton.appendChild(removeIcon);
1722
1798
  this._container.appendChild(this._removeButton);
1723
1799
  }
1724
1800
  // Set ARIA attributes and State attributes on Host
@@ -1939,6 +2015,16 @@
1939
2015
  this._tracking = { events: [], styles: [], limitations: [] };
1940
2016
  this._suppressBlurClose = false;
1941
2017
  this._renderCycleId = 0;
2018
+ this._suppressNextOpenClick = false;
2019
+ this._resolvedDropdownPlacement = 'bottom';
2020
+ this._multiScrollDrag = {
2021
+ active: false,
2022
+ moved: false,
2023
+ pointerId: -1,
2024
+ startX: 0,
2025
+ startScrollLeft: 0,
2026
+ };
2027
+ this._liftedAncestors = [];
1942
2028
  this._shadow = this.attachShadow({ mode: 'open' });
1943
2029
  this._uniqueId = `enhanced-select-${Math.random().toString(36).substr(2, 9)}`;
1944
2030
  this._rendererHelpers = this._buildRendererHelpers();
@@ -1966,6 +2052,7 @@
1966
2052
  // Create DOM structure
1967
2053
  this._container = this._createContainer();
1968
2054
  this._inputContainer = this._createInputContainer();
2055
+ this._inputContent = this._createInputContent();
1969
2056
  this._input = this._createInput();
1970
2057
  this._arrowContainer = this._createArrowContainer();
1971
2058
  this._clearControl = this._createClearControl();
@@ -1974,6 +2061,8 @@
1974
2061
  this._liveRegion = this._createLiveRegion();
1975
2062
  // Initialize styles BEFORE assembling DOM (order matters in shadow DOM)
1976
2063
  this._initializeStyles();
2064
+ this._syncStyleConfigVariables();
2065
+ this._syncDirectionConfig();
1977
2066
  this._assembleDOM();
1978
2067
  this._attachEventListeners();
1979
2068
  this._initializeObservers();
@@ -2009,6 +2098,7 @@
2009
2098
  clearTimeout(this._typeTimeout);
2010
2099
  if (this._searchTimeout)
2011
2100
  clearTimeout(this._searchTimeout);
2101
+ this._endMultiScrollDrag();
2012
2102
  // Cleanup arrow click listener
2013
2103
  if (this._boundArrowClick && this._arrowContainer) {
2014
2104
  this._arrowContainer.removeEventListener('click', this._boundArrowClick);
@@ -2142,6 +2232,203 @@
2142
2232
  }
2143
2233
  return container;
2144
2234
  }
2235
+ _createInputContent() {
2236
+ const content = document.createElement('div');
2237
+ content.className = 'input-content';
2238
+ return content;
2239
+ }
2240
+ _setCssVariable(name, value) {
2241
+ if (value == null || value === '') {
2242
+ this.style.removeProperty(name);
2243
+ return;
2244
+ }
2245
+ this.style.setProperty(name, String(value));
2246
+ }
2247
+ _applyStyleVariableMap(styleConfig, variableMap) {
2248
+ Object.entries(variableMap).forEach(([styleKey, variableName]) => {
2249
+ this._setCssVariable(variableName, styleConfig?.[styleKey]);
2250
+ });
2251
+ }
2252
+ _syncStyleConfigVariables() {
2253
+ const styles = this._config.styles;
2254
+ this._applyStyleVariableMap(styles.option, {
2255
+ background: '--select-option-bg',
2256
+ backgroundColor: '--select-option-bg',
2257
+ color: '--select-option-color',
2258
+ border: '--select-option-border',
2259
+ borderBottom: '--select-option-border-bottom',
2260
+ borderRadius: '--select-option-border-radius',
2261
+ boxShadow: '--select-option-shadow',
2262
+ transform: '--select-option-transform',
2263
+ padding: '--select-option-padding',
2264
+ margin: '--select-option-margin',
2265
+ fontSize: '--select-option-font-size',
2266
+ fontWeight: '--select-option-font-weight',
2267
+ lineHeight: '--select-option-line-height',
2268
+ textAlign: '--select-option-text-align',
2269
+ });
2270
+ this._applyStyleVariableMap(styles.selectedOption, {
2271
+ background: '--select-option-selected-bg',
2272
+ backgroundColor: '--select-option-selected-bg',
2273
+ color: '--select-option-selected-color',
2274
+ border: '--select-option-selected-border',
2275
+ borderBottom: '--select-option-selected-border-bottom',
2276
+ borderRadius: '--select-option-selected-border-radius',
2277
+ boxShadow: '--select-option-selected-shadow',
2278
+ transform: '--select-option-selected-transform',
2279
+ fontWeight: '--select-option-selected-weight',
2280
+ });
2281
+ this._applyStyleVariableMap(styles.hoverOption, {
2282
+ background: '--select-option-hover-bg',
2283
+ backgroundColor: '--select-option-hover-bg',
2284
+ color: '--select-option-hover-color',
2285
+ border: '--select-option-hover-border',
2286
+ borderBottom: '--select-option-hover-border-bottom',
2287
+ boxShadow: '--select-option-hover-shadow',
2288
+ transform: '--select-option-hover-transform',
2289
+ });
2290
+ this._applyStyleVariableMap(styles.activeOption, {
2291
+ background: '--select-option-active-bg',
2292
+ backgroundColor: '--select-option-active-bg',
2293
+ color: '--select-option-active-color',
2294
+ border: '--select-option-active-border',
2295
+ outline: '--select-option-active-outline',
2296
+ outlineOffset: '--select-option-active-outline-offset',
2297
+ boxShadow: '--select-option-active-shadow',
2298
+ transform: '--select-option-active-transform',
2299
+ });
2300
+ this._applyStyleVariableMap(styles.disabledOption, {
2301
+ background: '--select-option-disabled-bg',
2302
+ backgroundColor: '--select-option-disabled-bg',
2303
+ color: '--select-option-disabled-color',
2304
+ border: '--select-option-disabled-border',
2305
+ borderBottom: '--select-option-disabled-border-bottom',
2306
+ opacity: '--select-option-disabled-opacity',
2307
+ cursor: '--select-option-disabled-cursor',
2308
+ });
2309
+ this._applyStyleVariableMap(styles.badge, {
2310
+ width: '--select-badge-width',
2311
+ minWidth: '--select-badge-min-width',
2312
+ maxWidth: '--select-badge-max-width',
2313
+ height: '--select-badge-height',
2314
+ minHeight: '--select-badge-min-height',
2315
+ padding: '--select-badge-padding',
2316
+ margin: '--select-badge-margin',
2317
+ gap: '--select-badge-gap',
2318
+ background: '--select-badge-bg',
2319
+ backgroundColor: '--select-badge-bg',
2320
+ color: '--select-badge-color',
2321
+ border: '--select-badge-border',
2322
+ borderRadius: '--select-badge-border-radius',
2323
+ boxShadow: '--select-badge-shadow',
2324
+ fontSize: '--select-badge-font-size',
2325
+ fontWeight: '--select-badge-font-weight',
2326
+ lineHeight: '--select-badge-line-height',
2327
+ letterSpacing: '--select-badge-letter-spacing',
2328
+ });
2329
+ this._applyStyleVariableMap(styles.badgeHover, {
2330
+ background: '--select-badge-hover-bg',
2331
+ backgroundColor: '--select-badge-hover-bg',
2332
+ color: '--select-badge-hover-color',
2333
+ border: '--select-badge-hover-border',
2334
+ boxShadow: '--select-badge-hover-shadow',
2335
+ transform: '--select-badge-hover-transform',
2336
+ });
2337
+ this._applyStyleVariableMap(styles.badgeActive, {
2338
+ background: '--select-badge-active-bg',
2339
+ backgroundColor: '--select-badge-active-bg',
2340
+ color: '--select-badge-active-color',
2341
+ border: '--select-badge-active-border',
2342
+ boxShadow: '--select-badge-active-shadow',
2343
+ transform: '--select-badge-active-transform',
2344
+ });
2345
+ this._applyStyleVariableMap(styles.badgeLabel, {
2346
+ color: '--select-badge-label-color',
2347
+ fontSize: '--select-badge-label-font-size',
2348
+ fontWeight: '--select-badge-label-font-weight',
2349
+ lineHeight: '--select-badge-label-line-height',
2350
+ letterSpacing: '--select-badge-label-letter-spacing',
2351
+ textAlign: '--select-badge-label-text-align',
2352
+ });
2353
+ this._applyStyleVariableMap(styles.badgeRemove, {
2354
+ width: '--select-badge-remove-size',
2355
+ height: '--select-badge-remove-size',
2356
+ minWidth: '--select-badge-remove-min-width',
2357
+ minHeight: '--select-badge-remove-min-height',
2358
+ marginLeft: '--select-badge-remove-margin-left',
2359
+ background: '--select-badge-remove-bg',
2360
+ backgroundColor: '--select-badge-remove-bg',
2361
+ border: '--select-badge-remove-border',
2362
+ borderRadius: '--select-badge-remove-radius',
2363
+ color: '--select-badge-remove-color',
2364
+ fontSize: '--select-badge-remove-font-size',
2365
+ fontWeight: '--select-badge-remove-font-weight',
2366
+ });
2367
+ this._applyStyleVariableMap(styles.badgeRemoveHover, {
2368
+ background: '--select-badge-remove-hover-bg',
2369
+ backgroundColor: '--select-badge-remove-hover-bg',
2370
+ color: '--select-badge-remove-hover-color',
2371
+ border: '--select-badge-remove-hover-border',
2372
+ boxShadow: '--select-badge-remove-hover-shadow',
2373
+ transform: '--select-badge-remove-hover-transform',
2374
+ });
2375
+ this._applyStyleVariableMap(styles.badgeRemoveActive, {
2376
+ background: '--select-badge-remove-active-bg',
2377
+ backgroundColor: '--select-badge-remove-active-bg',
2378
+ color: '--select-badge-remove-active-color',
2379
+ border: '--select-badge-remove-active-border',
2380
+ boxShadow: '--select-badge-remove-active-shadow',
2381
+ transform: '--select-badge-remove-active-transform',
2382
+ });
2383
+ this._applyStyleVariableMap(styles.groupHeader, {
2384
+ padding: '--select-group-header-padding',
2385
+ margin: '--select-group-header-margin',
2386
+ color: '--select-group-header-color',
2387
+ background: '--select-group-header-bg',
2388
+ backgroundColor: '--select-group-header-bg',
2389
+ border: '--select-group-header-border',
2390
+ borderBottom: '--select-group-header-border-bottom',
2391
+ borderRadius: '--select-group-header-border-radius',
2392
+ boxShadow: '--select-group-header-shadow',
2393
+ textAlign: '--select-group-header-text-align',
2394
+ fontSize: '--select-group-header-font-size',
2395
+ fontWeight: '--select-group-header-weight',
2396
+ textTransform: '--select-group-header-text-transform',
2397
+ letterSpacing: '--select-group-header-letter-spacing',
2398
+ });
2399
+ }
2400
+ _resolveDropdownPlacement() {
2401
+ const placementMode = this._config.dropdownPlacement?.mode ?? 'bottom';
2402
+ if (placementMode === 'bottom' || placementMode === 'top') {
2403
+ return placementMode;
2404
+ }
2405
+ const hostRect = this._container.getBoundingClientRect();
2406
+ const availableBelow = window.innerHeight - hostRect.bottom;
2407
+ const computedDropdown = window.getComputedStyle(this._dropdown);
2408
+ const maxHeight = Number.parseFloat(computedDropdown.maxHeight || '0');
2409
+ const desiredHeight = Number.isFinite(maxHeight) && maxHeight > 0
2410
+ ? Math.min(this._dropdown.scrollHeight, maxHeight)
2411
+ : this._dropdown.scrollHeight;
2412
+ return availableBelow >= desiredHeight ? 'bottom' : 'top';
2413
+ }
2414
+ _syncDropdownPlacement() {
2415
+ if (!this._dropdown)
2416
+ return;
2417
+ this._resolvedDropdownPlacement = this._resolveDropdownPlacement();
2418
+ this._dropdown.setAttribute('data-placement', this._resolvedDropdownPlacement);
2419
+ }
2420
+ _syncDirectionConfig() {
2421
+ this.setAttribute('dir', this._config.direction ?? 'ltr');
2422
+ }
2423
+ _setIconContent(target, markup, fallback) {
2424
+ const content = markup && markup.trim() ? markup : fallback;
2425
+ target.innerHTML = '';
2426
+ if (content.trim().startsWith('<')) {
2427
+ target.innerHTML = content;
2428
+ return;
2429
+ }
2430
+ target.textContent = content;
2431
+ }
2145
2432
  _syncInputContainerMode() {
2146
2433
  if (!this._inputContainer || !this._input)
2147
2434
  return;
@@ -2158,6 +2445,121 @@
2158
2445
  this._input.style.width = '100%';
2159
2446
  this._input.style.minWidth = '0';
2160
2447
  }
2448
+ this._syncMultiSelectDisplayConfig();
2449
+ }
2450
+ _syncMultiSelectDisplayConfig() {
2451
+ if (!this._inputContainer || !this._input)
2452
+ return;
2453
+ const isMulti = this._config.selection.mode === 'multi';
2454
+ const mode = this._config.multiSelectDisplay?.mode ?? 'wrap';
2455
+ const dragEnabled = this._config.multiSelectDisplay?.dragScroll !== false;
2456
+ if (!isMulti) {
2457
+ this._inputContainer.removeAttribute('data-multi-scroll-mode');
2458
+ this._inputContainer.removeAttribute('data-drag-scroll');
2459
+ this._inputContainer.classList.remove('is-dragging-scroll');
2460
+ this._inputContainer.style.removeProperty('--select-multi-input-max-height');
2461
+ this._inputContainer.style.removeProperty('--select-multi-input-overflow-x');
2462
+ this._inputContainer.style.removeProperty('--select-multi-input-overflow-y');
2463
+ this._inputContainer.style.removeProperty('--select-multi-input-flex-wrap');
2464
+ this._inputContainer.style.removeProperty('--select-multi-input-align-content');
2465
+ return;
2466
+ }
2467
+ const maxHeight = this._config.multiSelectDisplay?.maxHeight ?? '160px';
2468
+ const overflowX = this._config.multiSelectDisplay?.overflowX ?? (mode === 'horizontal' ? 'auto' : 'hidden');
2469
+ const overflowY = this._config.multiSelectDisplay?.overflowY ?? (mode === 'horizontal' ? 'hidden' : 'auto');
2470
+ const flexWrap = mode === 'horizontal' ? 'nowrap' : 'wrap';
2471
+ const alignContent = mode === 'horizontal' ? 'center' : 'flex-start';
2472
+ this._inputContainer.setAttribute('data-multi-scroll-mode', mode);
2473
+ this._inputContainer.setAttribute('data-drag-scroll', String(dragEnabled && mode === 'horizontal'));
2474
+ this._inputContainer.style.setProperty('--select-multi-input-max-height', maxHeight);
2475
+ this._inputContainer.style.setProperty('--select-multi-input-overflow-x', overflowX);
2476
+ this._inputContainer.style.setProperty('--select-multi-input-overflow-y', overflowY);
2477
+ this._inputContainer.style.setProperty('--select-multi-input-flex-wrap', flexWrap);
2478
+ this._inputContainer.style.setProperty('--select-multi-input-align-content', alignContent);
2479
+ }
2480
+ _canUseHorizontalMultiScroll(target) {
2481
+ if (this._config.selection.mode !== 'multi')
2482
+ return false;
2483
+ if ((this._config.multiSelectDisplay?.mode ?? 'wrap') !== 'horizontal')
2484
+ return false;
2485
+ if (this._config.multiSelectDisplay?.dragScroll === false)
2486
+ return false;
2487
+ if (!target)
2488
+ return true;
2489
+ if (target.closest('.dropdown-arrow-container, .clear-control-button, .badge-remove'))
2490
+ return false;
2491
+ if (target.matches('.select-input'))
2492
+ return false;
2493
+ return true;
2494
+ }
2495
+ _isScrollableMultiSelectMode() {
2496
+ if (this._config.selection.mode !== 'multi')
2497
+ return false;
2498
+ const mode = this._config.multiSelectDisplay?.mode ?? 'wrap';
2499
+ return mode === 'vertical' || mode === 'horizontal';
2500
+ }
2501
+ _isPointerOnInputScrollbar(event) {
2502
+ if (!this._isScrollableMultiSelectMode())
2503
+ return false;
2504
+ const rect = this._inputContent.getBoundingClientRect();
2505
+ const verticalScrollbarWidth = this._inputContent.offsetWidth - this._inputContent.clientWidth;
2506
+ const horizontalScrollbarHeight = this._inputContent.offsetHeight - this._inputContent.clientHeight;
2507
+ if (verticalScrollbarWidth > 0
2508
+ && event.clientX >= rect.right - verticalScrollbarWidth
2509
+ && event.clientX <= rect.right
2510
+ && event.clientY >= rect.top
2511
+ && event.clientY <= rect.bottom) {
2512
+ return true;
2513
+ }
2514
+ if (horizontalScrollbarHeight > 0
2515
+ && event.clientY >= rect.bottom - horizontalScrollbarHeight
2516
+ && event.clientY <= rect.bottom
2517
+ && event.clientX >= rect.left
2518
+ && event.clientX <= rect.right) {
2519
+ return true;
2520
+ }
2521
+ return false;
2522
+ }
2523
+ _beginMultiScrollDrag(e) {
2524
+ const scrollHost = this._inputContent;
2525
+ this._multiScrollDrag.active = true;
2526
+ this._multiScrollDrag.moved = false;
2527
+ this._multiScrollDrag.pointerId = e.pointerId;
2528
+ this._multiScrollDrag.startX = e.clientX;
2529
+ this._multiScrollDrag.startScrollLeft = scrollHost.scrollLeft;
2530
+ this._inputContainer.classList.add('is-dragging-scroll');
2531
+ try {
2532
+ scrollHost.setPointerCapture(e.pointerId);
2533
+ }
2534
+ catch (_error) {
2535
+ // ignore pointer capture issues
2536
+ }
2537
+ }
2538
+ _updateMultiScrollDrag(e) {
2539
+ if (!this._multiScrollDrag.active || this._multiScrollDrag.pointerId !== e.pointerId)
2540
+ return;
2541
+ const deltaX = e.clientX - this._multiScrollDrag.startX;
2542
+ if (Math.abs(deltaX) > 3) {
2543
+ this._multiScrollDrag.moved = true;
2544
+ }
2545
+ this._inputContent.scrollLeft = this._multiScrollDrag.startScrollLeft - deltaX;
2546
+ }
2547
+ _endMultiScrollDrag(pointerId) {
2548
+ if (!this._multiScrollDrag.active)
2549
+ return;
2550
+ if (pointerId != null && this._multiScrollDrag.pointerId !== pointerId)
2551
+ return;
2552
+ try {
2553
+ if (this._multiScrollDrag.pointerId >= 0) {
2554
+ this._inputContent.releasePointerCapture(this._multiScrollDrag.pointerId);
2555
+ }
2556
+ }
2557
+ catch (_error) {
2558
+ // ignore pointer capture issues
2559
+ }
2560
+ this._multiScrollDrag.active = false;
2561
+ this._multiScrollDrag.pointerId = -1;
2562
+ this._inputContainer.classList.remove('is-dragging-scroll');
2161
2563
  }
2162
2564
  _createInput() {
2163
2565
  const input = document.createElement('input');
@@ -2286,7 +2688,8 @@
2286
2688
  return button;
2287
2689
  }
2288
2690
  _assembleDOM() {
2289
- this._inputContainer.appendChild(this._input);
2691
+ this._inputContent.appendChild(this._input);
2692
+ this._inputContainer.appendChild(this._inputContent);
2290
2693
  if (this._clearControl) {
2291
2694
  this._inputContainer.appendChild(this._clearControl);
2292
2695
  }
@@ -2343,9 +2746,11 @@
2343
2746
  --select-badge-enter-from-transform: scale(0.8) translateY(-4px);
2344
2747
  --select-badge-enter-to-opacity: 1;
2345
2748
  --select-badge-enter-to-transform: scale(1) translateY(0);
2749
+ --select-badge-active-transform: scale(0.98);
2346
2750
  --select-badge-hover-transform: scale(1.02);
2347
2751
  --select-badge-letter-spacing: 0.01em;
2348
2752
  --select-badge-hover-shadow: var(--select-shadow-md), inset 0 1px 0 rgba(255, 255, 255, 0.15);
2753
+ --select-badge-remove-icon-size: 10px;
2349
2754
  --select-badge-remove-focus-outline: 2px solid rgba(255, 255, 255, 0.5);
2350
2755
  --select-badge-remove-focus-offset: 1px;
2351
2756
  --select-badge-remove-hover-transform: scale(1.15) rotate(90deg);
@@ -2355,8 +2760,31 @@
2355
2760
  --select-input-font-weight: 450;
2356
2761
  --select-input-letter-spacing: 0.01em;
2357
2762
  --select-input-disabled-opacity: 0.6;
2763
+ --select-input-overflow-x: hidden;
2764
+ --select-input-align-items: center;
2765
+ --select-input-align-content: center;
2766
+ --select-input-align-self: center;
2767
+ --select-multi-input-max-height: 160px;
2768
+ --select-multi-input-overflow-x: hidden;
2769
+ --select-multi-input-overflow-y: auto;
2770
+ --select-multi-input-flex-wrap: wrap;
2771
+ --select-multi-input-align-content: flex-start;
2772
+ --select-multi-input-horizontal-input-flex: 0 0 var(--select-multi-input-min-width, 96px);
2773
+ --select-multi-input-horizontal-cursor: grab;
2774
+ --select-multi-input-horizontal-active-cursor: grabbing;
2775
+ --select-multi-separator-inset-block: 10px;
2776
+ --select-multi-action-surface-bg: var(--select-input-bg, var(--select-surface));
2777
+ --select-multi-action-divider: 1px solid var(--select-border);
2778
+ --select-separator-width: 1px;
2779
+ --select-separator-height: 50%;
2780
+ --select-separator-display: block;
2358
2781
  --select-separator-opacity: 0.6;
2359
2782
  --select-separator-active-opacity: 1;
2783
+ --select-separator-width: 1px;
2784
+ --select-separator-height: 50%;
2785
+ --select-separator-display: block;
2786
+ --select-separator-position: var(--select-arrow-width, 42px);
2787
+ --select-separator-position-with-clear: calc(var(--select-arrow-right-with-clear, 34px) + var(--select-arrow-width, 42px));
2360
2788
  --select-separator-dark-bg: linear-gradient(
2361
2789
  to bottom,
2362
2790
  transparent 0%,
@@ -2370,18 +2798,31 @@
2370
2798
  --select-clear-button-focus-offset: 2px;
2371
2799
  --select-clear-icon-size: 14px;
2372
2800
  --select-dropdown-top: calc(100% + 6px);
2801
+ --select-dropdown-bottom: calc(100% + 6px);
2373
2802
  --select-dropdown-animation: dropdownEnter 200ms cubic-bezier(0.4, 0, 0.2, 1) forwards;
2374
2803
  --select-dropdown-enter-from-opacity: 0;
2375
2804
  --select-dropdown-enter-from-transform: translateY(-8px) scale(0.98);
2376
2805
  --select-dropdown-enter-to-opacity: 1;
2377
2806
  --select-dropdown-enter-to-transform: translateY(0) scale(1);
2807
+ --select-dropdown-top-transform-origin: bottom center;
2808
+ --select-dropdown-top-enter-from-transform: translateY(8px) scale(0.98);
2809
+ --select-dropdown-padding: 6px;
2378
2810
  --select-dropdown-scroll-behavior: smooth;
2379
2811
  --select-dropdown-transform-origin: top center;
2380
2812
  --select-scrollbar-width: 6px;
2381
2813
  --select-scrollbar-thumb-radius: 3px;
2814
+ --select-option-hover-enabled: 1;
2382
2815
  --select-option-hover-transform: translateX(2px);
2383
2816
  --select-option-font-weight: 450;
2384
2817
  --select-option-margin: 2px 0;
2818
+ --select-input-font-size: inherit;
2819
+ --select-input-font-weight: 400;
2820
+ --select-multi-container-padding: 6px;
2821
+ --select-input-font-size: inherit;
2822
+ --select-input-font-weight: 400;
2823
+ --select-multi-container-padding: 6px;
2824
+ --select-option-disabled-opacity: 0.5;
2825
+ --select-option-disabled-cursor: not-allowed;
2385
2826
  --select-option-active-outline-offset: -2px;
2386
2827
  --select-option-selected-active-outline-offset: -2px;
2387
2828
  --select-option-selected-indicator-width: 3px;
@@ -2423,12 +2864,31 @@
2423
2864
  --select-high-contrast-focus-outline-color: Highlight;
2424
2865
  --select-touch-target-min-height: 44px;
2425
2866
  --select-badge-dark-bg: linear-gradient(135deg, var(--select-accent) 0%, #4f46e5 100%);
2867
+ --select-host-z-index: auto;
2868
+ --select-host-open-z-index: var(--select-dropdown-z-index, 1000);
2869
+ --select-ancestor-open-z-index: var(--select-host-open-z-index, var(--select-dropdown-z-index, 1000));
2426
2870
 
2427
2871
  display: block;
2428
2872
  position: relative;
2873
+ z-index: var(--select-host-z-index, auto);
2429
2874
  width: var(--select-width, 100%);
2430
2875
  height: var(--select-height, auto);
2431
- font-family: var(--select-font-family, 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif);
2876
+ font-family: var(--select-font-family, inherit);
2877
+ font-size: var(--select-font-size, inherit);
2878
+ line-height: var(--select-line-height, inherit);
2879
+ color: var(--select-color, inherit);
2880
+ }
2881
+
2882
+ :host([data-open="true"]) {
2883
+ z-index: var(--select-host-open-z-index, var(--select-dropdown-z-index, 1000));
2884
+ }
2885
+
2886
+ :host([dir="ltr"]) {
2887
+ direction: ltr;
2888
+ }
2889
+
2890
+ :host([dir="rtl"]) {
2891
+ direction: rtl;
2432
2892
  }
2433
2893
 
2434
2894
  /* ─────────────────────────────────────────────────────────────────────────
@@ -2440,6 +2900,9 @@
2440
2900
  align-items: center;
2441
2901
  gap: var(--select-badge-gap, 6px);
2442
2902
  flex: 0 1 auto;
2903
+ width: var(--select-badge-width, auto);
2904
+ min-width: var(--select-badge-min-width, 0);
2905
+ height: var(--select-badge-height, auto);
2443
2906
  min-height: var(--select-badge-min-height, 26px);
2444
2907
  padding: var(--select-badge-padding, 4px 10px 4px 12px);
2445
2908
  margin: var(--select-badge-margin, 3px);
@@ -2449,7 +2912,7 @@
2449
2912
  border-radius: var(--select-badge-border-radius, 999px);
2450
2913
  box-shadow: var(--select-badge-shadow, var(--select-shadow-sm), inset 0 1px 0 rgba(255, 255, 255, 0.1));
2451
2914
  box-sizing: border-box;
2452
- font-size: var(--select-badge-font-size, 13px);
2915
+ font-size: var(--select-badge-font-size, 0.8667em);
2453
2916
  font-weight: var(--select-badge-font-weight, 500);
2454
2917
  line-height: var(--select-badge-line-height, 1.2);
2455
2918
  letter-spacing: var(--select-badge-letter-spacing);
@@ -2475,17 +2938,33 @@
2475
2938
  }
2476
2939
 
2477
2940
  .selection-badge:hover {
2941
+ background: var(--select-badge-hover-bg, var(--select-badge-bg, linear-gradient(135deg, var(--select-accent) 0%, var(--select-primary-light) 100%)));
2942
+ color: var(--select-badge-hover-color, var(--select-badge-color, #ffffff));
2943
+ border: var(--select-badge-hover-border, var(--select-badge-border, none));
2478
2944
  box-shadow: var(--select-badge-hover-shadow);
2479
2945
  transform: var(--select-badge-hover-transform);
2480
2946
  }
2481
2947
 
2948
+ .selection-badge:active {
2949
+ background: var(--select-badge-active-bg, var(--select-badge-hover-bg, var(--select-badge-bg, linear-gradient(135deg, var(--select-accent) 0%, var(--select-primary-light) 100%))));
2950
+ color: var(--select-badge-active-color, var(--select-badge-hover-color, var(--select-badge-color, #ffffff)));
2951
+ border: var(--select-badge-active-border, var(--select-badge-hover-border, var(--select-badge-border, none)));
2952
+ box-shadow: var(--select-badge-active-shadow, var(--select-badge-hover-shadow));
2953
+ transform: var(--select-badge-active-transform);
2954
+ }
2955
+
2482
2956
  .selection-badge-label {
2483
2957
  display: block;
2484
2958
  min-width: 0;
2485
2959
  overflow: hidden;
2486
2960
  text-overflow: ellipsis;
2487
2961
  white-space: nowrap;
2488
- line-height: var(--select-badge-line-height, 1.2);
2962
+ color: var(--select-badge-label-color, inherit);
2963
+ font-size: var(--select-badge-label-font-size, inherit);
2964
+ font-weight: var(--select-badge-label-font-weight, inherit);
2965
+ line-height: var(--select-badge-label-line-height, var(--select-badge-line-height, 1.2));
2966
+ letter-spacing: var(--select-badge-label-letter-spacing, inherit);
2967
+ text-align: var(--select-badge-label-text-align, start);
2489
2968
  }
2490
2969
 
2491
2970
  .badge-remove {
@@ -2494,24 +2973,47 @@
2494
2973
  justify-content: center;
2495
2974
  width: var(--select-badge-remove-size, 18px);
2496
2975
  height: var(--select-badge-remove-size, 18px);
2976
+ min-width: var(--select-badge-remove-min-width, var(--select-badge-remove-size, 18px));
2977
+ min-height: var(--select-badge-remove-min-height, var(--select-badge-remove-size, 18px));
2497
2978
  padding: 0;
2498
2979
  margin-left: var(--select-badge-remove-margin-left);
2499
2980
  background: var(--select-badge-remove-bg, rgba(255, 255, 255, 0.2));
2500
2981
  border: var(--select-badge-remove-border, none);
2501
2982
  border-radius: var(--select-badge-remove-radius);
2502
2983
  color: var(--select-badge-remove-color, #ffffff);
2503
- font-size: var(--select-badge-remove-font-size, 11px);
2984
+ font-size: var(--select-badge-remove-font-size, 0.7333em);
2504
2985
  font-weight: var(--select-badge-remove-font-weight);
2505
2986
  line-height: 1;
2506
2987
  cursor: pointer;
2507
2988
  flex: 0 0 auto;
2508
2989
  transition:
2509
2990
  background var(--select-transition-fast),
2991
+ color var(--select-transition-fast),
2992
+ border-color var(--select-transition-fast),
2993
+ box-shadow var(--select-transition-fast),
2510
2994
  transform var(--select-transition-bounce);
2511
2995
  }
2996
+
2997
+ .badge-remove-icon {
2998
+ display: inline-flex;
2999
+ align-items: center;
3000
+ justify-content: center;
3001
+ width: var(--select-badge-remove-icon-size, 10px);
3002
+ height: var(--select-badge-remove-icon-size, 10px);
3003
+ pointer-events: none;
3004
+ }
3005
+
3006
+ .badge-remove-icon svg {
3007
+ width: 100%;
3008
+ height: 100%;
3009
+ display: block;
3010
+ }
2512
3011
 
2513
3012
  .badge-remove:hover {
2514
3013
  background: var(--select-badge-remove-hover-bg, rgba(233, 69, 96, 0.9));
3014
+ color: var(--select-badge-remove-hover-color, var(--select-badge-remove-color, #ffffff));
3015
+ border: var(--select-badge-remove-hover-border, var(--select-badge-remove-border, none));
3016
+ box-shadow: var(--select-badge-remove-hover-shadow, none);
2515
3017
  transform: var(--select-badge-remove-hover-transform);
2516
3018
  }
2517
3019
 
@@ -2521,8 +3023,17 @@
2521
3023
  }
2522
3024
 
2523
3025
  .badge-remove:active {
3026
+ background: var(--select-badge-remove-active-bg, var(--select-badge-remove-hover-bg, rgba(233, 69, 96, 0.9)));
3027
+ color: var(--select-badge-remove-active-color, var(--select-badge-remove-hover-color, var(--select-badge-remove-color, #ffffff)));
3028
+ border: var(--select-badge-remove-active-border, var(--select-badge-remove-hover-border, var(--select-badge-remove-border, none)));
3029
+ box-shadow: var(--select-badge-remove-active-shadow, var(--select-badge-remove-hover-shadow, none));
2524
3030
  transform: var(--select-badge-remove-active-transform);
2525
3031
  }
3032
+
3033
+ :host([dir="rtl"]) .badge-remove {
3034
+ margin-left: 0;
3035
+ margin-right: var(--select-badge-remove-margin-left);
3036
+ }
2526
3037
 
2527
3038
  /* ─────────────────────────────────────────────────────────────────────────
2528
3039
  Input Container — Sophisticated control shell
@@ -2537,16 +3048,22 @@
2537
3048
  position: relative;
2538
3049
  width: 100%;
2539
3050
  display: flex;
2540
- align-items: center;
3051
+ align-items: var(--select-input-align-items, center);
2541
3052
  flex-wrap: nowrap;
3053
+ justify-content: var(--select-input-justify-content, flex-start);
2542
3054
  gap: var(--select-input-gap, 6px);
2543
3055
  padding: var(--select-input-padding, 10px 52px 10px 14px);
2544
3056
  height: var(--select-input-height, auto);
2545
3057
  min-height: var(--select-input-min-height, 48px);
2546
3058
  max-height: var(--select-input-max-height, 160px);
2547
- overflow-y: var(--select-input-overflow-y, auto);
2548
- align-content: center;
3059
+ overflow: hidden;
3060
+ padding: var(--select-multi-container-padding, 6px);
3061
+ align-content: var(--select-input-align-content, center);
3062
+ text-align: var(--select-input-text-align, start);
2549
3063
  background: var(--select-input-bg, var(--select-surface));
3064
+ font-size: var(--select-input-font-size, inherit);
3065
+ font-weight: var(--select-input-font-weight, 400);
3066
+ font-weight: var(--select-input-font-weight, 400);
2550
3067
  border: var(--select-input-border, 1.5px solid var(--select-border));
2551
3068
  border-radius: var(--select-input-border-radius, var(--select-radius-md));
2552
3069
  box-shadow: var(--select-shadow-sm);
@@ -2556,6 +3073,25 @@
2556
3073
  box-shadow var(--select-transition-smooth),
2557
3074
  transform var(--select-transition-fast);
2558
3075
  }
3076
+
3077
+ .input-content {
3078
+ position: relative;
3079
+ display: flex;
3080
+ flex: 1 1 auto;
3081
+ width: 100%;
3082
+ min-width: 0;
3083
+ min-height: 0;
3084
+ align-self: stretch;
3085
+ align-items: var(--select-input-align-items, center);
3086
+ align-content: var(--select-input-align-content, center);
3087
+ justify-content: var(--select-input-justify-content, flex-start);
3088
+ flex-wrap: nowrap;
3089
+ gap: var(--select-input-gap, 6px);
3090
+ overflow-x: var(--select-input-overflow-x, hidden);
3091
+ overflow-y: var(--select-input-overflow-y, hidden);
3092
+ scrollbar-width: thin;
3093
+ box-sizing: border-box;
3094
+ }
2559
3095
 
2560
3096
  .input-container:hover {
2561
3097
  border-color: var(--select-input-hover-border);
@@ -2568,8 +3104,75 @@
2568
3104
  }
2569
3105
 
2570
3106
  .input-container.input-container--multi {
2571
- flex-wrap: wrap;
2572
- align-content: flex-start;
3107
+ max-height: var(--select-multi-input-max-height, var(--select-input-max-height, 160px));
3108
+ }
3109
+
3110
+ .input-container.input-container--multi .input-content {
3111
+ flex-wrap: var(--select-multi-input-flex-wrap, wrap);
3112
+ align-content: var(--select-multi-input-align-content, flex-start);
3113
+ overflow-x: var(--select-multi-input-overflow-x, hidden);
3114
+ overflow-y: var(--select-multi-input-overflow-y, auto);
3115
+ }
3116
+
3117
+ .input-container.input-container--multi::after {
3118
+ top: var(--select-multi-separator-inset-block, 10px);
3119
+ bottom: var(--select-multi-separator-inset-block, 10px);
3120
+ height: auto;
3121
+ transform: none;
3122
+ }
3123
+
3124
+ .input-container.input-container--multi[data-multi-scroll-mode="horizontal"] {
3125
+ align-items: stretch;
3126
+ }
3127
+
3128
+ .input-container.input-container--multi[data-multi-scroll-mode="horizontal"] .input-content {
3129
+ cursor: var(--select-multi-input-horizontal-cursor, grab);
3130
+ overflow-y: hidden;
3131
+ overscroll-behavior-x: contain;
3132
+ }
3133
+
3134
+ .input-container.input-container--multi[data-multi-scroll-mode="horizontal"]::after {
3135
+ display: none;
3136
+ }
3137
+
3138
+ .input-container.input-container--multi[data-multi-scroll-mode="horizontal"].is-dragging-scroll .input-content {
3139
+ cursor: var(--select-multi-input-horizontal-active-cursor, grabbing);
3140
+ user-select: none;
3141
+ }
3142
+
3143
+ .input-container.input-container--multi[data-multi-scroll-mode="horizontal"] .input-content .selection-badge {
3144
+ flex: 0 0 auto;
3145
+ }
3146
+
3147
+ .input-container.input-container--multi[data-multi-scroll-mode="horizontal"] .input-content > .select-input,
3148
+ .input-container.input-container--multi[data-multi-scroll-mode="horizontal"] .input-content > input.select-input,
3149
+ .input-container.input-container--multi[data-multi-scroll-mode="horizontal"] .input-content > .select-input[type="text"] {
3150
+ flex: var(--select-multi-input-horizontal-input-flex, 0 0 var(--select-multi-input-min-width, 96px));
3151
+ }
3152
+
3153
+ .input-container.input-container--multi[data-multi-scroll-mode="horizontal"] .dropdown-arrow-container {
3154
+ background: var(--select-multi-action-surface-bg, var(--select-input-bg, var(--select-surface)));
3155
+ border-left: var(--select-multi-action-divider, 1px solid var(--select-border));
3156
+ z-index: 4;
3157
+ }
3158
+
3159
+ .input-container.input-container--multi[data-multi-scroll-mode="horizontal"] .dropdown-arrow-container.with-clear-control {
3160
+ right: var(--select-arrow-right-with-clear, 34px);
3161
+ }
3162
+
3163
+ :host([dir="rtl"]) .input-container.input-container--multi[data-multi-scroll-mode="horizontal"] .dropdown-arrow-container {
3164
+ border-left: none;
3165
+ border-right: var(--select-multi-action-divider, 1px solid var(--select-border));
3166
+ }
3167
+
3168
+ :host([dir="rtl"]) .input-container.input-container--multi[data-multi-scroll-mode="horizontal"] .dropdown-arrow-container.with-clear-control {
3169
+ right: auto;
3170
+ left: var(--select-arrow-right-with-clear, 34px);
3171
+ }
3172
+
3173
+ .input-container.input-container--multi[data-multi-scroll-mode="horizontal"] .clear-control-button {
3174
+ background: var(--select-multi-action-surface-bg, var(--select-input-bg, var(--select-surface)));
3175
+ z-index: 4;
2573
3176
  }
2574
3177
 
2575
3178
  .input-container:focus-within {
@@ -2580,9 +3183,10 @@
2580
3183
  /* Elegant separator line before arrow */
2581
3184
  .input-container::after {
2582
3185
  content: '';
3186
+ display: var(--select-separator-display, block);
2583
3187
  position: absolute;
2584
3188
  top: 50%;
2585
- right: var(--select-separator-position, 42px);
3189
+ right: var(--select-separator-position, var(--select-arrow-width, 42px));
2586
3190
  transform: translateY(-50%);
2587
3191
  width: var(--select-separator-width, 1px);
2588
3192
  height: var(--select-separator-height, 50%);
@@ -2603,6 +3207,11 @@
2603
3207
  .input-container:focus-within::after {
2604
3208
  opacity: var(--select-separator-active-opacity);
2605
3209
  }
3210
+
3211
+ :host([dir="rtl"]) .input-container::after {
3212
+ right: auto;
3213
+ left: var(--select-separator-position, var(--select-arrow-width, 42px));
3214
+ }
2606
3215
 
2607
3216
  /* ─────────────────────────────────────────────────────────────────────────
2608
3217
  Dropdown Arrow — Smooth rotation with refined styling
@@ -2629,13 +3238,29 @@
2629
3238
  }
2630
3239
 
2631
3240
  .input-container.has-clear-control::after {
2632
- right: var(--select-separator-position-with-clear, 74px);
3241
+ right: var(--select-separator-position-with-clear, calc(var(--select-arrow-right-with-clear, 34px) + var(--select-arrow-width, 42px)));
2633
3242
  }
2634
3243
 
2635
3244
  .dropdown-arrow-container.with-clear-control {
2636
3245
  right: var(--select-arrow-right-with-clear, 34px);
2637
3246
  }
2638
3247
 
3248
+ :host([dir="rtl"]) .dropdown-arrow-container {
3249
+ right: auto;
3250
+ left: 0;
3251
+ border-radius: var(--select-arrow-border-radius-rtl, var(--select-radius-md) 0 0 var(--select-radius-md));
3252
+ }
3253
+
3254
+ :host([dir="rtl"]) .input-container.has-clear-control::after {
3255
+ right: auto;
3256
+ left: var(--select-separator-position-with-clear, calc(var(--select-arrow-right-with-clear, 34px) + var(--select-arrow-width, 42px)));
3257
+ }
3258
+
3259
+ :host([dir="rtl"]) .dropdown-arrow-container.with-clear-control {
3260
+ right: auto;
3261
+ left: var(--select-arrow-right-with-clear, 34px);
3262
+ }
3263
+
2639
3264
  /* ─────────────────────────────────────────────────────────────────────────
2640
3265
  Clear Control — Minimal and elegant dismiss button
2641
3266
  ───────────────────────────────────────────────────────────────────────── */
@@ -2681,6 +3306,11 @@
2681
3306
  display: none;
2682
3307
  }
2683
3308
 
3309
+ :host([dir="rtl"]) .clear-control-button {
3310
+ right: auto;
3311
+ left: var(--select-clear-button-right, 8px);
3312
+ }
3313
+
2684
3314
  .clear-control-icon {
2685
3315
  width: var(--select-clear-icon-size);
2686
3316
  height: var(--select-clear-icon-size);
@@ -2735,7 +3365,7 @@
2735
3365
  padding: var(--select-input-field-padding, 0) !important;
2736
3366
  margin: 0 !important;
2737
3367
  border: 0 !important;
2738
- font-size: var(--select-input-font-size, 15px);
3368
+ font-size: var(--select-input-font-size, inherit);
2739
3369
  line-height: var(--select-input-line-height, 1.5);
2740
3370
  color: var(--select-input-color, var(--select-text));
2741
3371
  background: transparent !important;
@@ -2743,13 +3373,16 @@
2743
3373
  outline: none !important;
2744
3374
  font-weight: var(--select-input-font-weight);
2745
3375
  letter-spacing: var(--select-input-letter-spacing);
2746
- align-self: center;
3376
+ font-family: var(--select-input-font-family, inherit);
3377
+ font-style: var(--select-input-font-style, normal);
3378
+ align-self: var(--select-input-align-self, center);
2747
3379
  appearance: none !important;
2748
3380
  -webkit-appearance: none !important;
2749
3381
  box-shadow: none !important;
2750
3382
  border-radius: 0 !important;
2751
3383
  overflow: hidden;
2752
3384
  text-overflow: ellipsis;
3385
+ text-align: var(--select-input-text-align, inherit);
2753
3386
  white-space: nowrap;
2754
3387
  }
2755
3388
 
@@ -2758,6 +3391,14 @@
2758
3391
  font-weight: 400;
2759
3392
  }
2760
3393
 
3394
+ :host([dir="rtl"]) .input-container {
3395
+ padding: var(--select-input-padding-rtl, 10px 14px 10px 52px);
3396
+ }
3397
+
3398
+ :host([dir="rtl"]) .input-container.has-clear-control {
3399
+ padding: var(--select-input-padding-with-clear-rtl, 10px 14px 10px 84px);
3400
+ }
3401
+
2761
3402
  .input-container.input-container--multi > .select-input,
2762
3403
  .input-container.input-container--multi > input.select-input,
2763
3404
  .input-container.input-container--multi > .select-input[type="text"] {
@@ -2788,10 +3429,12 @@
2788
3429
  position: absolute;
2789
3430
  scroll-behavior: var(--select-dropdown-scroll-behavior);
2790
3431
  top: var(--select-dropdown-top);
3432
+ bottom: auto;
2791
3433
  left: 0;
2792
3434
  right: 0;
2793
3435
  max-height: var(--select-dropdown-max-height, 320px);
2794
3436
  overflow: hidden;
3437
+ box-sizing: border-box;
2795
3438
  background: var(--select-dropdown-bg, var(--select-surface));
2796
3439
  border: 1px solid var(--select-dropdown-border, var(--select-border));
2797
3440
  border-radius: var(--select-dropdown-border-radius, var(--select-radius-lg));
@@ -2800,6 +3443,16 @@
2800
3443
  transform-origin: var(--select-dropdown-transform-origin);
2801
3444
  animation: var(--select-dropdown-animation);
2802
3445
  }
3446
+
3447
+ .select-dropdown[data-placement="top"] {
3448
+ top: auto;
3449
+ bottom: var(--select-dropdown-bottom, calc(100% + 6px));
3450
+ transform-origin: var(--select-dropdown-top-transform-origin, bottom center);
3451
+ }
3452
+
3453
+ .select-dropdown[data-placement="top"] {
3454
+ --select-dropdown-enter-from-transform: var(--select-dropdown-top-enter-from-transform, translateY(8px) scale(0.98));
3455
+ }
2803
3456
 
2804
3457
  @keyframes dropdownEnter {
2805
3458
  0% {
@@ -2816,8 +3469,9 @@
2816
3469
  position: relative;
2817
3470
  max-height: var(--select-options-max-height, 320px);
2818
3471
  overflow: auto;
2819
- padding: var(--select-options-padding, 6px);
2820
- background: var(--select-options-bg, var(--select-surface));
3472
+ box-sizing: border-box;
3473
+ padding: var(--select-options-padding, var(--select-dropdown-padding, 6px));
3474
+ background: var(--select-options-bg, var(--select-dropdown-bg, var(--select-surface)));
2821
3475
 
2822
3476
  /* Custom scrollbar styling */
2823
3477
  scrollbar-width: thin;
@@ -2846,18 +3500,26 @@
2846
3500
  ───────────────────────────────────────────────────────────────────────── */
2847
3501
 
2848
3502
  .group-header {
2849
- padding: var(--select-group-header-padding, 10px 12px 6px);
3503
+ padding: var(--select-group-header-padding, 10px 12px 8px 12px);
3504
+ margin: var(--select-group-header-margin, 0 calc(var(--select-options-padding, 6px) * -1));
2850
3505
  font-weight: var(--select-group-header-weight, 600);
2851
3506
  color: var(--select-group-header-color, var(--select-text-muted));
2852
- background-color: var(--select-group-header-bg, var(--select-surface));
3507
+ background: var(--select-group-header-bg, #ffffff);
2853
3508
  text-align: var(--select-group-header-text-align, left);
2854
- font-size: var(--select-group-header-font-size, 11px);
3509
+ font-size: var(--select-group-header-font-size, 0.7333em);
2855
3510
  text-transform: var(--select-group-header-text-transform, uppercase);
2856
3511
  letter-spacing: var(--select-group-header-letter-spacing, 0.08em);
2857
3512
  position: sticky;
2858
- top: 0;
2859
- z-index: 1;
2860
- border-bottom: var(--select-group-header-border-bottom, none);
3513
+ top: calc(var(--select-options-padding, 6px) * -1);
3514
+ left: 0;
3515
+ right: 0;
3516
+ z-index: 100;
3517
+ border: var(--select-group-header-border, none);
3518
+ border-bottom: var(--select-group-header-border-bottom, 1px solid rgba(0, 0, 0, 0.08));
3519
+ border-radius: var(--select-group-header-border-radius, 0);
3520
+ box-shadow: var(--select-group-header-shadow, 0 1px 2px rgba(0, 0, 0, 0.04));
3521
+ /* Force solid background to prevent option bleed-through */
3522
+ isolation: isolate;
2861
3523
  }
2862
3524
 
2863
3525
  .group-header:not(:first-child) {
@@ -2876,13 +3538,16 @@
2876
3538
  cursor: pointer;
2877
3539
  color: var(--select-option-color, var(--select-text));
2878
3540
  background: var(--select-option-bg, transparent);
3541
+ border: var(--select-option-border, none);
3542
+ text-align: var(--select-option-text-align, start);
2879
3543
  transition:
2880
3544
  background var(--select-transition-fast),
2881
3545
  color var(--select-transition-fast),
3546
+ border-color var(--select-transition-fast),
2882
3547
  transform var(--select-transition-fast),
2883
3548
  box-shadow var(--select-transition-fast);
2884
3549
  user-select: none;
2885
- font-size: var(--select-option-font-size, 14px);
3550
+ font-size: var(--select-option-font-size, inherit);
2886
3551
  font-weight: var(--select-option-font-weight);
2887
3552
  line-height: var(--select-option-line-height, 1.5);
2888
3553
  border-radius: var(--select-option-border-radius, var(--select-radius-sm));
@@ -2890,13 +3555,15 @@
2890
3555
  }
2891
3556
 
2892
3557
  .option:hover {
2893
- background: var(--select-option-hover-bg, var(--select-surface-elevated));
2894
- color: var(--select-option-hover-color, var(--select-text));
2895
- transform: var(--select-option-hover-transform);
3558
+ background: calc(var(--select-option-hover-enabled, 1) * 1) > 0 ? var(--select-option-hover-bg, var(--select-surface-elevated)) : var(--select-option-bg, transparent);
3559
+ border: calc(var(--select-option-hover-enabled, 1) * 1) > 0 ? var(--select-option-hover-border, var(--select-option-border, none)) : var(--select-option-border, none);
3560
+ color: calc(var(--select-option-hover-enabled, 1) * 1) > 0 ? var(--select-option-hover-color, var(--select-text)) : var(--select-option-color, var(--select-text));
3561
+ transform: calc(var(--select-option-hover-enabled, 1) * 1) > 0 ? var(--select-option-hover-transform) : none;
2896
3562
  }
2897
3563
 
2898
3564
  .option.selected {
2899
3565
  background: var(--select-option-selected-bg, linear-gradient(135deg, rgba(15, 52, 96, 0.08) 0%, rgba(15, 52, 96, 0.04) 100%));
3566
+ border: var(--select-option-selected-border, var(--select-option-border, none));
2900
3567
  color: var(--select-option-selected-color, var(--select-accent));
2901
3568
  font-weight: var(--select-option-selected-weight, 550);
2902
3569
  }
@@ -2913,6 +3580,12 @@
2913
3580
  border-radius: var(--select-option-selected-indicator-radius);
2914
3581
  animation: var(--select-option-selected-indicator-animation);
2915
3582
  }
3583
+
3584
+ :host([dir="rtl"]) .option.selected::before {
3585
+ left: auto;
3586
+ right: var(--select-option-selected-indicator-right, var(--select-option-selected-indicator-left));
3587
+ border-radius: var(--select-option-selected-indicator-radius-rtl, 2px 0 0 2px);
3588
+ }
2916
3589
 
2917
3590
  @keyframes selectedIndicator {
2918
3591
  0% {
@@ -2926,13 +3599,19 @@
2926
3599
  }
2927
3600
 
2928
3601
  .option.selected:hover {
2929
- background: var(--select-option-selected-hover-bg, linear-gradient(135deg, rgba(15, 52, 96, 0.12) 0%, rgba(15, 52, 96, 0.06) 100%));
3602
+ background: var(--select-option-selected-hover-bg, var(--select-option-selected-bg, linear-gradient(135deg, rgba(15, 52, 96, 0.12) 0%, rgba(15, 52, 96, 0.06) 100%)));
3603
+ border: var(--select-option-selected-hover-border, var(--select-option-selected-border, var(--select-option-hover-border, var(--select-option-border, none))));
3604
+ color: var(--select-option-selected-hover-color, var(--select-option-selected-color, var(--select-accent)));
2930
3605
  }
2931
3606
 
2932
3607
  .option.active:not(.selected) {
2933
3608
  background: var(--select-option-active-bg, var(--select-surface-elevated));
3609
+ color: var(--select-option-active-color, var(--select-option-hover-color, var(--select-option-color, var(--select-text))));
3610
+ border: var(--select-option-active-border, var(--select-option-hover-border, var(--select-option-border, none)));
2934
3611
  outline: var(--select-option-active-outline, 2px solid rgba(15, 52, 96, 0.3));
2935
3612
  outline-offset: var(--select-option-active-outline-offset);
3613
+ box-shadow: var(--select-option-active-shadow, none);
3614
+ transform: var(--select-option-active-transform, none);
2936
3615
  }
2937
3616
 
2938
3617
  .option.selected.active {
@@ -2940,6 +3619,14 @@
2940
3619
  outline-offset: var(--select-option-selected-active-outline-offset);
2941
3620
  }
2942
3621
 
3622
+ .option.disabled {
3623
+ background: var(--select-option-disabled-bg, var(--select-option-bg, transparent));
3624
+ color: var(--select-option-disabled-color, var(--select-text-muted));
3625
+ border: var(--select-option-disabled-border, var(--select-option-border, none));
3626
+ opacity: var(--select-option-disabled-opacity, 0.5);
3627
+ cursor: var(--select-option-disabled-cursor, not-allowed);
3628
+ }
3629
+
2943
3630
  .option:active:not(.selected) {
2944
3631
  background: var(--select-option-pressed-bg, rgba(15, 52, 96, 0.08));
2945
3632
  transform: var(--select-option-pressed-transform);
@@ -2965,7 +3652,7 @@
2965
3652
  color: var(--select-button-color, var(--select-accent));
2966
3653
  border-radius: var(--select-button-border-radius, var(--select-radius-md));
2967
3654
  cursor: pointer;
2968
- font-size: var(--select-button-font-size, 13px);
3655
+ font-size: var(--select-button-font-size, 0.8667em);
2969
3656
  font-weight: var(--select-button-font-weight);
2970
3657
  letter-spacing: var(--select-button-letter-spacing);
2971
3658
  transition:
@@ -2997,7 +3684,7 @@
2997
3684
  text-align: center;
2998
3685
  color: var(--select-busy-color, var(--select-text-muted));
2999
3686
  background: var(--select-busy-bg, transparent);
3000
- font-size: var(--select-busy-font-size, 13px);
3687
+ font-size: var(--select-busy-font-size, 0.8667em);
3001
3688
  }
3002
3689
 
3003
3690
  .spinner {
@@ -3018,7 +3705,7 @@
3018
3705
  padding: var(--select-empty-padding, 32px 24px);
3019
3706
  text-align: center;
3020
3707
  color: var(--select-empty-color, var(--select-text-muted));
3021
- font-size: var(--select-empty-font-size, 14px);
3708
+ font-size: var(--select-empty-font-size, 0.9333em);
3022
3709
  background: var(--select-empty-bg, transparent);
3023
3710
  display: flex;
3024
3711
  flex-direction: column;
@@ -3031,7 +3718,7 @@
3031
3718
  padding: var(--select-searching-padding, 32px 24px);
3032
3719
  text-align: center;
3033
3720
  color: var(--select-searching-color, var(--select-accent));
3034
- font-size: var(--select-searching-font-size, 14px);
3721
+ font-size: var(--select-searching-font-size, 0.9333em);
3035
3722
  background: var(--select-searching-bg, transparent);
3036
3723
  display: flex;
3037
3724
  flex-direction: column;
@@ -3121,24 +3808,44 @@
3121
3808
  --select-primary-light: #2a2a3e;
3122
3809
  --select-accent: #6366f1;
3123
3810
  --select-accent-hover: #f43f5e;
3124
- --select-surface: #1a1a2e;
3811
+ --select-surface: var(--select-dark-bg, #1a1a2e);
3125
3812
  --select-surface-elevated: #252540;
3126
- --select-border: #3f3f5a;
3813
+ --select-border: var(--select-dark-border, #3f3f5a);
3127
3814
  --select-border-focus: #6366f1;
3128
- --select-text: #f5f5f5;
3815
+ --select-text: var(--select-dark-text, #f5f5f5);
3129
3816
  --select-text-muted: #9ca3af;
3130
3817
  --select-text-placeholder: #6b7280;
3131
3818
  --select-shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.2);
3132
3819
  --select-shadow-md: 0 4px 12px rgba(0, 0, 0, 0.3);
3133
3820
  --select-shadow-lg: 0 8px 24px rgba(0, 0, 0, 0.4);
3134
3821
  --select-shadow-focus: 0 0 0 3px rgba(99, 102, 241, 0.25);
3822
+
3823
+ --select-dropdown-bg: var(--select-dark-dropdown-bg, var(--select-surface));
3824
+
3825
+ --select-arrow-color: var(--select-dark-arrow-color, #9ca3af);
3826
+ --select-arrow-hover-color: var(--select-dark-arrow-hover-color, #f5f5f5);
3827
+ --select-arrow-bg: var(--select-dark-arrow-bg, transparent);
3828
+ --select-arrow-hover-bg: var(--select-dark-arrow-hover-bg, rgba(156, 163, 175, 0.15));
3829
+
3830
+ --select-separator-bg: var(--select-dark-separator-bg, var(--select-separator-dark-bg));
3831
+ --select-separator-width: var(--select-dark-separator-width, 1px);
3135
3832
 
3136
- --select-option-bg: transparent;
3137
- --select-option-color: var(--select-text);
3138
- --select-option-hover-bg: var(--select-surface-elevated);
3139
- --select-option-hover-color: var(--select-text);
3140
- --select-option-selected-bg: linear-gradient(135deg, rgba(99, 102, 241, 0.15) 0%, rgba(99, 102, 241, 0.08) 100%);
3141
- --select-option-selected-color: #a5b4fc;
3833
+ --select-badge-bg: var(--select-dark-badge-bg, rgba(99, 102, 241, 0.2));
3834
+ --select-badge-color: var(--select-dark-badge-color, #e0e7ff);
3835
+
3836
+ --select-group-header-bg: var(--select-group-header-dark-bg, #1a1a2e);
3837
+ --select-group-header-color: var(--select-group-header-dark-color, #9ca3af);
3838
+
3839
+ --select-empty-color: var(--select-dark-empty-color, #9ca3af);
3840
+
3841
+ --select-option-bg: var(--select-dark-option-bg, transparent);
3842
+ --select-option-color: var(--select-dark-option-color, var(--select-text));
3843
+ --select-option-hover-bg: var(--select-dark-option-hover-bg, var(--select-surface-elevated));
3844
+ --select-option-hover-color: var(--select-dark-option-hover-color, var(--select-text));
3845
+ --select-option-selected-bg: var(--select-dark-option-selected-bg, linear-gradient(135deg, rgba(99, 102, 241, 0.15) 0%, rgba(99, 102, 241, 0.08) 100%));
3846
+ --select-option-selected-color: var(--select-dark-option-selected-color, #a5b4fc);
3847
+ --select-option-selected-hover-bg: var(--select-dark-option-selected-hover-bg, var(--select-option-selected-bg));
3848
+ --select-option-selected-hover-color: var(--select-dark-option-selected-hover-color, var(--select-option-selected-color));
3142
3849
  }
3143
3850
 
3144
3851
  :host(.dark-mode) .input-container,
@@ -3181,7 +3888,7 @@
3181
3888
  :host-context([darkmode]) .select-dropdown,
3182
3889
  :host-context([data-theme="dark"]) .select-dropdown,
3183
3890
  :host-context([theme="dark"]) .select-dropdown {
3184
- background: var(--select-surface);
3891
+ background: var(--select-dropdown-bg, var(--select-surface));
3185
3892
  border-color: var(--select-border);
3186
3893
  }
3187
3894
 
@@ -3196,7 +3903,7 @@
3196
3903
  :host-context([darkmode]) .options-container,
3197
3904
  :host-context([data-theme="dark"]) .options-container,
3198
3905
  :host-context([theme="dark"]) .options-container {
3199
- background: var(--select-surface);
3906
+ background: var(--select-dropdown-bg, var(--select-surface));
3200
3907
  scrollbar-color: var(--select-border) transparent;
3201
3908
  }
3202
3909
 
@@ -3228,6 +3935,22 @@
3228
3935
  border-top-color: var(--select-border);
3229
3936
  }
3230
3937
 
3938
+ :host(.dark-mode) .group-header,
3939
+ :host([dark-mode]) .group-header,
3940
+ :host([darkmode]) .group-header,
3941
+ :host([data-theme="dark"]) .group-header,
3942
+ :host([theme="dark"]) .group-header,
3943
+ :host-context(.dark-mode) .group-header,
3944
+ :host-context(.dark) .group-header,
3945
+ :host-context([dark-mode]) .group-header,
3946
+ :host-context([darkmode]) .group-header,
3947
+ :host-context([data-theme="dark"]) .group-header,
3948
+ :host-context([theme="dark"]) .group-header {
3949
+ background: var(--select-group-header-bg, #1a1a2e);
3950
+ border-bottom: var(--select-group-header-border-bottom, 1px solid rgba(255, 255, 255, 0.08));
3951
+ box-shadow: var(--select-group-header-shadow, 0 1px 2px rgba(0, 0, 0, 0.3));
3952
+ }
3953
+
3231
3954
  :host(.dark-mode) .option.selected::before,
3232
3955
  :host([dark-mode]) .option.selected::before,
3233
3956
  :host([darkmode]) .option.selected::before,
@@ -3293,6 +4016,19 @@
3293
4016
  return;
3294
4017
  if (target && target.closest('.clear-control-button'))
3295
4018
  return;
4019
+ if (this._isPointerOnInputScrollbar(e)) {
4020
+ this._suppressNextOpenClick = true;
4021
+ return;
4022
+ }
4023
+ const isHorizontalMultiMode = this._config.selection.mode === 'multi'
4024
+ && (this._config.multiSelectDisplay?.mode ?? 'wrap') === 'horizontal';
4025
+ const enableHorizontalDrag = this._canUseHorizontalMultiScroll(target);
4026
+ if (enableHorizontalDrag && e.button === 0) {
4027
+ this._beginMultiScrollDrag(e);
4028
+ this._suppressNextOpenClick = false;
4029
+ e.preventDefault();
4030
+ return;
4031
+ }
3296
4032
  // If we clicked the container, but not the input itself, we must prevent default
3297
4033
  // otherwise the browser moves focus from our input to the body, immediately triggering blur.
3298
4034
  if (target && !target.matches('.select-input')) {
@@ -3301,6 +4037,8 @@
3301
4037
  const clickedInput = Boolean(target && target.matches('.select-input'));
3302
4038
  if (this._state.isOpen &&
3303
4039
  this._config.selection.toggleOnTriggerClick !== false &&
4040
+ !isHorizontalMultiMode &&
4041
+ !enableHorizontalDrag &&
3304
4042
  !(clickedInput && this._config.searchable)) {
3305
4043
  this._handleClose();
3306
4044
  return;
@@ -3323,6 +4061,47 @@
3323
4061
  }
3324
4062
  }
3325
4063
  });
4064
+ this._inputContainer.addEventListener('click', (e) => {
4065
+ const target = e.target;
4066
+ const isHorizontalMultiMode = this._config.selection.mode === 'multi'
4067
+ && (this._config.multiSelectDisplay?.mode ?? 'wrap') === 'horizontal';
4068
+ if (!this._config.enabled || !isHorizontalMultiMode) {
4069
+ this._suppressNextOpenClick = false;
4070
+ this._multiScrollDrag.moved = false;
4071
+ return;
4072
+ }
4073
+ if (target && target.closest('.dropdown-arrow-container, .clear-control-button')) {
4074
+ this._suppressNextOpenClick = false;
4075
+ this._multiScrollDrag.moved = false;
4076
+ return;
4077
+ }
4078
+ if (this._suppressNextOpenClick || this._multiScrollDrag.moved || this._isPointerOnInputScrollbar(e)) {
4079
+ this._suppressNextOpenClick = false;
4080
+ this._multiScrollDrag.moved = false;
4081
+ return;
4082
+ }
4083
+ this._suppressNextOpenClick = false;
4084
+ this._multiScrollDrag.moved = false;
4085
+ if (!this._state.isOpen) {
4086
+ this._handleOpen();
4087
+ }
4088
+ this._input.focus();
4089
+ });
4090
+ this._inputContent.addEventListener('pointermove', (e) => {
4091
+ this._updateMultiScrollDrag(e);
4092
+ });
4093
+ this._inputContent.addEventListener('pointerup', (e) => {
4094
+ this._endMultiScrollDrag(e.pointerId);
4095
+ });
4096
+ this._inputContent.addEventListener('pointercancel', (e) => {
4097
+ this._endMultiScrollDrag(e.pointerId);
4098
+ });
4099
+ this._inputContent.addEventListener('wheel', (e) => {
4100
+ if (this._config.selection.mode === 'multi'
4101
+ && (this._config.multiSelectDisplay?.mode ?? 'wrap') === 'horizontal') {
4102
+ e.preventDefault();
4103
+ }
4104
+ }, { passive: false });
3326
4105
  // Input container click - prevent event from reaching document listener
3327
4106
  this._container.addEventListener('click', (e) => {
3328
4107
  e.stopPropagation();
@@ -3493,11 +4272,14 @@
3493
4272
  this._input.focus();
3494
4273
  this._markOpenStart();
3495
4274
  this._state.isOpen = true;
4275
+ this.setAttribute('data-open', 'true');
4276
+ this._liftStackingAncestors();
3496
4277
  this._dropdown.style.display = 'block';
3497
4278
  this._input.setAttribute('aria-expanded', 'true');
3498
4279
  this._updateArrowRotation();
3499
4280
  // Render options when opening
3500
4281
  this._renderOptions();
4282
+ this._syncDropdownPlacement();
3501
4283
  this._setInitialActiveOption();
3502
4284
  this._emit('open', {});
3503
4285
  this._config.callbacks.onOpen?.();
@@ -3517,7 +4299,10 @@
3517
4299
  if (!this._state.isOpen)
3518
4300
  return;
3519
4301
  this._state.isOpen = false;
4302
+ this.removeAttribute('data-open');
4303
+ this._restoreLiftedAncestors();
3520
4304
  this._dropdown.style.display = 'none';
4305
+ this._dropdown.setAttribute('data-placement', this._resolvedDropdownPlacement);
3521
4306
  this._input.setAttribute('aria-expanded', 'false');
3522
4307
  this._input.removeAttribute('aria-activedescendant');
3523
4308
  this._updateArrowRotation();
@@ -3527,14 +4312,76 @@
3527
4312
  }
3528
4313
  _updateDropdownVisibility() {
3529
4314
  if (this._state.isOpen) {
4315
+ this.setAttribute('data-open', 'true');
4316
+ this._liftStackingAncestors();
3530
4317
  this._dropdown.style.display = 'block';
4318
+ this._syncDropdownPlacement();
3531
4319
  this._input.setAttribute('aria-expanded', 'true');
3532
4320
  }
3533
4321
  else {
4322
+ this.removeAttribute('data-open');
4323
+ this._restoreLiftedAncestors();
3534
4324
  this._dropdown.style.display = 'none';
3535
4325
  this._input.setAttribute('aria-expanded', 'false');
3536
4326
  }
3537
4327
  }
4328
+ _liftStackingAncestors() {
4329
+ this._restoreLiftedAncestors();
4330
+ let ancestor = this.parentElement;
4331
+ while (ancestor && ancestor !== document.body) {
4332
+ if (this._createsStackingContext(ancestor)) {
4333
+ const hadMarker = ancestor.hasAttribute('data-smilodon-open-ancestor');
4334
+ this._liftedAncestors.push({
4335
+ element: ancestor,
4336
+ position: ancestor.style.position,
4337
+ zIndex: ancestor.style.zIndex,
4338
+ hadMarker,
4339
+ });
4340
+ if (getComputedStyle(ancestor).position === 'static') {
4341
+ ancestor.style.position = 'relative';
4342
+ }
4343
+ ancestor.style.zIndex = 'var(--select-ancestor-open-z-index, var(--select-host-open-z-index, var(--select-dropdown-z-index, 1000)))';
4344
+ ancestor.setAttribute('data-smilodon-open-ancestor', 'true');
4345
+ }
4346
+ ancestor = ancestor.parentElement;
4347
+ }
4348
+ }
4349
+ _restoreLiftedAncestors() {
4350
+ for (const lifted of this._liftedAncestors) {
4351
+ lifted.element.style.position = lifted.position;
4352
+ lifted.element.style.zIndex = lifted.zIndex;
4353
+ if (!lifted.hadMarker) {
4354
+ lifted.element.removeAttribute('data-smilodon-open-ancestor');
4355
+ }
4356
+ }
4357
+ this._liftedAncestors = [];
4358
+ }
4359
+ _createsStackingContext(element) {
4360
+ const style = getComputedStyle(element);
4361
+ if (style.position === 'fixed' || style.position === 'sticky')
4362
+ return true;
4363
+ if (style.zIndex !== 'auto' && style.position !== 'static')
4364
+ return true;
4365
+ if (style.opacity !== '1')
4366
+ return true;
4367
+ if (style.transform !== 'none')
4368
+ return true;
4369
+ if (style.filter !== 'none')
4370
+ return true;
4371
+ if (style.backdropFilter && style.backdropFilter !== 'none')
4372
+ return true;
4373
+ if (style.perspective !== 'none')
4374
+ return true;
4375
+ if (style.mixBlendMode !== 'normal')
4376
+ return true;
4377
+ if (style.isolation === 'isolate')
4378
+ return true;
4379
+ if (style.contain.includes('paint') || style.contain.includes('layout'))
4380
+ return true;
4381
+ if (style.willChange.includes('transform') || style.willChange.includes('opacity') || style.willChange.includes('filter'))
4382
+ return true;
4383
+ return false;
4384
+ }
3538
4385
  _updateArrowRotation() {
3539
4386
  if (this._arrowContainer) {
3540
4387
  const arrow = this._arrowContainer.querySelector('.dropdown-arrow');
@@ -3698,8 +4545,12 @@
3698
4545
  }
3699
4546
  break;
3700
4547
  case 'Enter':
4548
+ case ' ':
3701
4549
  e.preventDefault();
3702
- if (this._state.activeIndex >= 0) {
4550
+ if (!this._state.isOpen) {
4551
+ this._handleOpen();
4552
+ }
4553
+ else if (this._state.activeIndex >= 0) {
3703
4554
  this._selectOption(this._state.activeIndex, { shiftKey: e.shiftKey, toggleKey: e.ctrlKey || e.metaKey });
3704
4555
  }
3705
4556
  break;
@@ -4006,7 +4857,7 @@
4006
4857
  this._input.value = '';
4007
4858
  this._input.placeholder = this._config.placeholder || 'Select an option...';
4008
4859
  // Clear any badges
4009
- const existingBadges = this._inputContainer.querySelectorAll('.selection-badge');
4860
+ const existingBadges = this._inputContent.querySelectorAll('.selection-badge');
4010
4861
  existingBadges.forEach(badge => badge.remove());
4011
4862
  }
4012
4863
  else if (this._config.selection.mode === 'single') {
@@ -4017,16 +4868,23 @@
4017
4868
  this._input.value = '';
4018
4869
  this._input.placeholder = '';
4019
4870
  // Clear existing badges
4020
- const existingBadges = this._inputContainer.querySelectorAll('.selection-badge');
4871
+ const existingBadges = this._inputContent.querySelectorAll('.selection-badge');
4021
4872
  existingBadges.forEach(badge => badge.remove());
4022
4873
  // Create badges for each selected item
4023
4874
  const selectedEntries = Array.from(this._state.selectedItems.entries());
4024
4875
  selectedEntries.forEach(([index, item]) => {
4025
4876
  const badge = document.createElement('span');
4026
4877
  badge.className = 'selection-badge';
4878
+ if (this._config.styles.classNames?.badge) {
4879
+ badge.classList.add(...this._config.styles.classNames.badge.split(' ').filter(Boolean));
4880
+ }
4027
4881
  badge.setAttribute('part', 'chip');
4028
4882
  const badgeLabel = document.createElement('span');
4029
4883
  badgeLabel.className = 'selection-badge-label';
4884
+ if (this._config.styles.classNames?.badgeLabel) {
4885
+ badgeLabel.classList.add(...this._config.styles.classNames.badgeLabel.split(' ').filter(Boolean));
4886
+ }
4887
+ badgeLabel.setAttribute('part', 'chip-label');
4030
4888
  badgeLabel.textContent = getLabel(item);
4031
4889
  badge.appendChild(badgeLabel);
4032
4890
  // Add remove button to badge
@@ -4034,9 +4892,19 @@
4034
4892
  const removeBtn = document.createElement('button');
4035
4893
  removeBtn.type = 'button';
4036
4894
  removeBtn.className = 'badge-remove';
4895
+ if (this._config.styles.classNames?.removeButton) {
4896
+ removeBtn.classList.add(...this._config.styles.classNames.removeButton.split(' ').filter(Boolean));
4897
+ }
4898
+ if (this._config.styles.classNames?.badgeRemove) {
4899
+ removeBtn.classList.add(...this._config.styles.classNames.badgeRemove.split(' ').filter(Boolean));
4900
+ }
4037
4901
  removeBtn.setAttribute('part', 'chip-remove');
4038
- removeBtn.innerHTML = '×';
4039
4902
  removeBtn.setAttribute('aria-label', `Remove ${getLabel(item)}`);
4903
+ const removeIcon = document.createElement('span');
4904
+ removeIcon.className = 'badge-remove-icon';
4905
+ removeIcon.setAttribute('part', 'chip-remove-icon');
4906
+ this._setIconContent(removeIcon, this._config.selection.removeButtonIcon, '×');
4907
+ removeBtn.appendChild(removeIcon);
4040
4908
  removeBtn.addEventListener('pointerdown', (e) => {
4041
4909
  e.stopPropagation();
4042
4910
  e.preventDefault();
@@ -4048,7 +4916,7 @@
4048
4916
  });
4049
4917
  badge.appendChild(removeBtn);
4050
4918
  }
4051
- this._inputContainer.insertBefore(badge, this._input);
4919
+ this._inputContent.insertBefore(badge, this._input);
4052
4920
  });
4053
4921
  }
4054
4922
  this._syncClearControlState();
@@ -4521,6 +5389,7 @@
4521
5389
  if (this._clearControlIcon) {
4522
5390
  this._clearControlIcon.innerHTML = `<svg viewBox="0 0 16 16" fill="none" xmlns="http://www.w3.org/2000/svg"><path d="M12 4L4 12M4 4L12 12" stroke="currentColor" stroke-width="1.5" stroke-linecap="round" stroke-linejoin="round"/></svg>`;
4523
5391
  }
5392
+ this._syncStyleConfigVariables();
4524
5393
  if (this._dropdown) {
4525
5394
  if (this._config.selection.mode === 'multi') {
4526
5395
  this._dropdown.setAttribute('aria-multiselectable', 'true');
@@ -4529,10 +5398,14 @@
4529
5398
  this._dropdown.removeAttribute('aria-multiselectable');
4530
5399
  }
4531
5400
  }
5401
+ this._syncDirectionConfig();
4532
5402
  this._syncInputContainerMode();
5403
+ this._syncMultiSelectDisplayConfig();
5404
+ this._syncDropdownPlacement();
4533
5405
  // Re-initialize observers in case infinite scroll was enabled/disabled
4534
5406
  this._initializeObservers();
4535
5407
  this._syncClearControlState();
5408
+ this._updateInputDisplay();
4536
5409
  this._renderOptions();
4537
5410
  }
4538
5411
  _mergeConfig(target, source) {
@@ -4688,6 +5561,9 @@
4688
5561
  header.textContent = group.label;
4689
5562
  }
4690
5563
  header.classList.add('group-header');
5564
+ if (this._config.styles.classNames?.groupHeader) {
5565
+ header.classList.add(...this._config.styles.classNames.groupHeader.split(' ').filter(Boolean));
5566
+ }
4691
5567
  header.setAttribute('part', 'group-header');
4692
5568
  this._optionsContainer.appendChild(header);
4693
5569
  group.options.forEach(item => {
@@ -4815,6 +5691,7 @@
4815
5691
  disabled: isDisabled,
4816
5692
  id: optionId,
4817
5693
  });
5694
+ optionElement.setAttribute('dir', this._config.direction ?? 'ltr');
4818
5695
  targetContainer.appendChild(optionElement);
4819
5696
  return;
4820
5697
  }
@@ -4828,8 +5705,23 @@
4828
5705
  getValue,
4829
5706
  getLabel,
4830
5707
  showRemoveButton: this._config.selection.mode === 'multi' && this._config.selection.showRemoveButton,
5708
+ removeButtonIcon: this._config.selection.removeButtonIcon,
4831
5709
  classMap: this.classMap,
5710
+ className: this._config.styles.classNames?.option,
4832
5711
  });
5712
+ if (this._config.styles.classNames?.option) {
5713
+ option.classList.add(...this._config.styles.classNames.option.split(' ').filter(Boolean));
5714
+ }
5715
+ option.setAttribute('dir', this._config.direction ?? 'ltr');
5716
+ if (isSelected && this._config.styles.classNames?.selectedOption) {
5717
+ option.classList.add(...this._config.styles.classNames.selectedOption.split(' ').filter(Boolean));
5718
+ }
5719
+ if (this._state.activeIndex === index && this._config.styles.classNames?.activeOption) {
5720
+ option.classList.add(...this._config.styles.classNames.activeOption.split(' ').filter(Boolean));
5721
+ }
5722
+ if (isDisabled && this._config.styles.classNames?.disabledOption) {
5723
+ option.classList.add(...this._config.styles.classNames.disabledOption.split(' ').filter(Boolean));
5724
+ }
4833
5725
  // Valid part attribute on the web component host itself
4834
5726
  option.setAttribute('part', 'option');
4835
5727
  option.dataset.index = String(index);
@@ -4863,6 +5755,9 @@
4863
5755
  }
4864
5756
  // Add both semantic namespaced classes and the legacy internal classes that CSS uses
4865
5757
  optionEl.classList.add('smilodon-option', 'option');
5758
+ if (this._config.styles.classNames?.option) {
5759
+ optionEl.classList.add(...this._config.styles.classNames.option.split(' ').filter(Boolean));
5760
+ }
4866
5761
  // Toggle state classes using classMap if available
4867
5762
  const isSelected = meta.selected;
4868
5763
  const isActive = meta.active;
@@ -4874,26 +5769,44 @@
4874
5769
  if (isSelected) {
4875
5770
  optionEl.classList.add(...selectedClasses);
4876
5771
  optionEl.classList.add('smilodon-option--selected');
5772
+ if (this._config.styles.classNames?.selectedOption) {
5773
+ optionEl.classList.add(...this._config.styles.classNames.selectedOption.split(' ').filter(Boolean));
5774
+ }
4877
5775
  }
4878
5776
  else {
4879
5777
  optionEl.classList.remove(...selectedClasses);
4880
5778
  optionEl.classList.remove('smilodon-option--selected');
5779
+ if (this._config.styles.classNames?.selectedOption) {
5780
+ optionEl.classList.remove(...this._config.styles.classNames.selectedOption.split(' ').filter(Boolean));
5781
+ }
4881
5782
  }
4882
5783
  if (isActive) {
4883
5784
  optionEl.classList.add(...activeClasses);
4884
5785
  optionEl.classList.add('smilodon-option--active');
5786
+ if (this._config.styles.classNames?.activeOption) {
5787
+ optionEl.classList.add(...this._config.styles.classNames.activeOption.split(' ').filter(Boolean));
5788
+ }
4885
5789
  }
4886
5790
  else {
4887
5791
  optionEl.classList.remove(...activeClasses);
4888
5792
  optionEl.classList.remove('smilodon-option--active');
5793
+ if (this._config.styles.classNames?.activeOption) {
5794
+ optionEl.classList.remove(...this._config.styles.classNames.activeOption.split(' ').filter(Boolean));
5795
+ }
4889
5796
  }
4890
5797
  if (isDisabled) {
4891
5798
  optionEl.classList.add(...disabledClasses);
4892
5799
  optionEl.classList.add('smilodon-option--disabled');
5800
+ if (this._config.styles.classNames?.disabledOption) {
5801
+ optionEl.classList.add(...this._config.styles.classNames.disabledOption.split(' ').filter(Boolean));
5802
+ }
4893
5803
  }
4894
5804
  else {
4895
5805
  optionEl.classList.remove(...disabledClasses);
4896
5806
  optionEl.classList.remove('smilodon-option--disabled');
5807
+ if (this._config.styles.classNames?.disabledOption) {
5808
+ optionEl.classList.remove(...this._config.styles.classNames.disabledOption.split(' ').filter(Boolean));
5809
+ }
4897
5810
  }
4898
5811
  // Data Attributes Contract
4899
5812
  const state = [];