@smilodon/core 1.5.5 → 1.6.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.cjs CHANGED
@@ -1348,8 +1348,14 @@ const defaultConfig = {
1348
1348
  selection: {
1349
1349
  mode: 'single',
1350
1350
  allowDeselect: false,
1351
+ disabledOptionBehavior: {
1352
+ selectable: false,
1353
+ hoverable: false,
1354
+ focusable: false,
1355
+ },
1351
1356
  maxSelections: 0,
1352
1357
  showRemoveButton: true,
1358
+ showSelectedIndicator: true,
1353
1359
  removeButtonIcon: '×',
1354
1360
  closeOnSelect: true,
1355
1361
  toggleOnTriggerClick: true,
@@ -1526,53 +1532,18 @@ class SelectOption extends HTMLElement {
1526
1532
  display: block;
1527
1533
  position: relative;
1528
1534
  font: inherit;
1529
- color: inherit;
1530
- }
1531
-
1532
- /* Allow authors to style selected state from outside the shadow root
1533
- by setting attributes/classes on the host element. This mirrors the
1534
- internal .option-container.selected rules but reads the same CSS
1535
- custom properties so themes can fully control selected appearance. */
1536
- :host([aria-selected="true"]) .option-container,
1537
- :host(.smilodon-option--selected) .option-container {
1538
- background: var(--select-option-selected-bg, #e3f2fd);
1539
- color: var(--select-option-selected-color, #1976d2);
1540
- border: var(--select-option-selected-border, var(--select-option-border, none));
1541
- border-bottom: var(--select-option-selected-border-bottom, var(--select-option-border-bottom, none));
1542
- border-radius: var(--select-option-selected-border-radius, var(--select-option-border-radius, 0));
1543
- box-shadow: var(--select-option-selected-shadow, var(--select-option-shadow, none));
1544
- transform: var(--select-option-selected-transform, var(--select-option-transform, none));
1545
- }
1546
-
1547
- :host([aria-selected="true"]) .option-container:hover,
1548
- :host(.smilodon-option--selected) .option-container:hover {
1549
- background: var(--select-option-selected-hover-bg, var(--select-option-selected-bg, #e3f2fd));
1550
- color: var(--select-option-selected-hover-color, var(--select-option-selected-color, #1976d2));
1551
- border: var(--select-option-selected-hover-border, var(--select-option-selected-border, var(--select-option-border, none)));
1552
- border-bottom: var(--select-option-selected-hover-border-bottom, var(--select-option-selected-border-bottom, var(--select-option-border-bottom, none)));
1553
- box-shadow: var(--select-option-selected-hover-shadow, var(--select-option-selected-shadow, var(--select-option-shadow, none)));
1554
- transform: var(--select-option-selected-hover-transform, var(--select-option-selected-transform, var(--select-option-transform, none)));
1555
- }
1556
-
1557
- .option-container {
1558
- display: flex;
1559
- align-items: center;
1560
- justify-content: space-between;
1561
- padding: var(--select-option-padding, 10px 14px);
1562
- cursor: pointer;
1563
- user-select: none;
1564
1535
  color: var(--select-option-color, var(--select-text-color, #1f2937));
1565
1536
  background: var(--select-option-bg, var(--select-dropdown-bg, var(--select-bg, white)));
1566
- transition: var(--select-option-transition, background-color 0.2s ease);
1567
1537
  border: var(--select-option-border, none);
1568
1538
  border-bottom: var(--select-option-border-bottom, none);
1569
1539
  border-radius: var(--select-option-border-radius, var(--select-radius-sm, 6px));
1570
1540
  box-shadow: var(--select-option-shadow, none);
1571
1541
  transform: var(--select-option-transform, none);
1572
- font: inherit;
1542
+ transition: var(--select-option-transition, background-color 0.2s ease);
1573
1543
  }
1574
-
1575
- .option-container:hover {
1544
+
1545
+ :host(:hover):not(.smilodon-option--disabled):not([aria-disabled="true"]),
1546
+ :host(.smilodon-option--disabled-hoverable:hover) {
1576
1547
  background: var(--select-option-hover-bg, #f0f0f0);
1577
1548
  color: var(--select-option-hover-color, var(--select-option-color, var(--select-text-color, #1f2937)));
1578
1549
  border: var(--select-option-hover-border, var(--select-option-border, none));
@@ -1580,8 +1551,12 @@ class SelectOption extends HTMLElement {
1580
1551
  box-shadow: var(--select-option-hover-shadow, var(--select-option-shadow, none));
1581
1552
  transform: var(--select-option-hover-transform, var(--select-option-transform, none));
1582
1553
  }
1583
-
1584
- .option-container.selected {
1554
+
1555
+ /* Keep the visual surface on the host so external utility classes applied
1556
+ through classMap can override selected/active/disabled styles in both
1557
+ light and dark themes. */
1558
+ :host([aria-selected="true"]),
1559
+ :host(.smilodon-option--selected) {
1585
1560
  background: var(--select-option-selected-bg, #e3f2fd);
1586
1561
  color: var(--select-option-selected-color, #1976d2);
1587
1562
  border: var(--select-option-selected-border, var(--select-option-border, none));
@@ -1591,7 +1566,8 @@ class SelectOption extends HTMLElement {
1591
1566
  transform: var(--select-option-selected-transform, var(--select-option-transform, none));
1592
1567
  }
1593
1568
 
1594
- .option-container.selected:hover {
1569
+ :host([aria-selected="true"]:hover),
1570
+ :host(.smilodon-option--selected:hover) {
1595
1571
  background: var(--select-option-selected-hover-bg, var(--select-option-selected-bg, #e3f2fd));
1596
1572
  color: var(--select-option-selected-hover-color, var(--select-option-selected-color, #1976d2));
1597
1573
  border: var(--select-option-selected-hover-border, var(--select-option-selected-border, var(--select-option-border, none)));
@@ -1599,18 +1575,20 @@ class SelectOption extends HTMLElement {
1599
1575
  box-shadow: var(--select-option-selected-hover-shadow, var(--select-option-selected-shadow, var(--select-option-shadow, none)));
1600
1576
  transform: var(--select-option-selected-hover-transform, var(--select-option-selected-transform, var(--select-option-transform, none)));
1601
1577
  }
1602
-
1603
- .option-container.active:not(.disabled) {
1578
+
1579
+ :host(.smilodon-option--active):not(.smilodon-option--disabled):not([aria-disabled="true"]),
1580
+ :host(.smilodon-option--active.smilodon-option--disabled-focusable) {
1604
1581
  background: var(--select-option-active-bg, var(--select-option-hover-bg, #f0f0f0));
1605
1582
  color: var(--select-option-active-color, var(--select-option-hover-color, var(--select-option-color, var(--select-text-color, #1f2937))));
1606
1583
  border: var(--select-option-active-border, var(--select-option-hover-border, var(--select-option-border, none)));
1607
1584
  box-shadow: var(--select-option-active-shadow, var(--select-option-shadow, none));
1608
1585
  transform: var(--select-option-active-transform, var(--select-option-transform, none));
1609
- outline: var(--select-option-active-outline, 2px solid #1976d2);
1586
+ outline: var(--select-option-active-outline, none);
1610
1587
  outline-offset: var(--select-option-active-outline-offset, -2px);
1611
1588
  }
1612
-
1613
- .option-container.disabled {
1589
+
1590
+ :host(.smilodon-option--disabled),
1591
+ :host([aria-disabled="true"]) {
1614
1592
  background: var(--select-option-disabled-bg, var(--select-option-bg, var(--select-dropdown-bg, var(--select-bg, white))));
1615
1593
  color: var(--select-option-disabled-color, var(--select-option-color, var(--select-text-color, #1f2937)));
1616
1594
  border: var(--select-option-disabled-border, var(--select-option-border, none));
@@ -1619,6 +1597,76 @@ class SelectOption extends HTMLElement {
1619
1597
  cursor: var(--select-option-disabled-cursor, not-allowed);
1620
1598
  pointer-events: none;
1621
1599
  }
1600
+
1601
+ :host(.smilodon-option--disabled-interactive) {
1602
+ pointer-events: auto;
1603
+ }
1604
+
1605
+ .option-container {
1606
+ display: flex;
1607
+ align-items: center;
1608
+ justify-content: space-between;
1609
+ padding: var(--select-option-padding, 10px 14px);
1610
+ cursor: pointer;
1611
+ user-select: none;
1612
+ color: inherit;
1613
+ background: inherit;
1614
+ transition: inherit;
1615
+ border: inherit;
1616
+ border-bottom: inherit;
1617
+ border-radius: inherit;
1618
+ box-shadow: inherit;
1619
+ transform: inherit;
1620
+ font: inherit;
1621
+ }
1622
+
1623
+ .option-container:hover {
1624
+ background: inherit;
1625
+ color: inherit;
1626
+ border: inherit;
1627
+ border-bottom: inherit;
1628
+ box-shadow: inherit;
1629
+ transform: inherit;
1630
+ }
1631
+
1632
+ .option-container.selected {
1633
+ background: inherit;
1634
+ color: inherit;
1635
+ border: inherit;
1636
+ border-bottom: inherit;
1637
+ border-radius: inherit;
1638
+ box-shadow: inherit;
1639
+ transform: inherit;
1640
+ }
1641
+
1642
+ .option-container.selected:hover {
1643
+ background: inherit;
1644
+ color: inherit;
1645
+ border: inherit;
1646
+ border-bottom: inherit;
1647
+ box-shadow: inherit;
1648
+ transform: inherit;
1649
+ }
1650
+
1651
+ .option-container.active:not(.disabled) {
1652
+ background: inherit;
1653
+ color: inherit;
1654
+ border: inherit;
1655
+ box-shadow: inherit;
1656
+ transform: inherit;
1657
+ outline: none;
1658
+ outline-offset: 0;
1659
+ }
1660
+
1661
+ .option-container.disabled {
1662
+ background: inherit;
1663
+ color: inherit;
1664
+ border: inherit;
1665
+ border-bottom: inherit;
1666
+ opacity: inherit;
1667
+ cursor: inherit;
1668
+ pointer-events: none;
1669
+ }
1622
1670
 
1623
1671
  .option-content {
1624
1672
  flex: 1;
@@ -1677,6 +1725,11 @@ class SelectOption extends HTMLElement {
1677
1725
  justify-content: center;
1678
1726
  width: var(--select-badge-remove-icon-size, 10px);
1679
1727
  height: var(--select-badge-remove-icon-size, 10px);
1728
+ color: var(--select-badge-remove-icon-color, currentColor);
1729
+ font-size: var(--select-badge-remove-icon-font-size, inherit);
1730
+ line-height: var(--select-badge-remove-icon-line-height, 1);
1731
+ transform: var(--select-badge-remove-icon-transform, none);
1732
+ opacity: var(--select-badge-remove-icon-opacity, 1);
1680
1733
  pointer-events: none;
1681
1734
  }
1682
1735
 
@@ -1698,8 +1751,20 @@ class SelectOption extends HTMLElement {
1698
1751
  `;
1699
1752
  this._shadow.appendChild(style);
1700
1753
  }
1754
+ _getDisabledBehavior() {
1755
+ const behavior = this._config.disabledBehavior ?? {};
1756
+ return {
1757
+ selectable: behavior.selectable === true,
1758
+ hoverable: behavior.hoverable === true,
1759
+ focusable: behavior.focusable === true,
1760
+ };
1761
+ }
1762
+ _isDisabledSelectionBlocked() {
1763
+ return Boolean(this._config.disabled) && !this._getDisabledBehavior().selectable;
1764
+ }
1701
1765
  _render() {
1702
1766
  const { item, index, selected, disabled, active, render, showRemoveButton, classMap } = this._config;
1767
+ const disabledBehavior = this._getDisabledBehavior();
1703
1768
  // Clear container
1704
1769
  this._container.innerHTML = '';
1705
1770
  // Add part attribute
@@ -1728,7 +1793,7 @@ class SelectOption extends HTMLElement {
1728
1793
  toggleClasses(this._container, [...selectedClasses, 'smilodon-option--selected'], false);
1729
1794
  toggleClasses(this, [...selectedClasses, 'smilodon-option--selected'], false);
1730
1795
  }
1731
- if (active && !disabled) {
1796
+ if (active && (!disabled || disabledBehavior.focusable)) {
1732
1797
  toggleClasses(this._container, [...activeClasses, 'smilodon-option--active'], true);
1733
1798
  toggleClasses(this, [...activeClasses, 'smilodon-option--active'], true); // Make focus ring visible on host
1734
1799
  }
@@ -1744,6 +1809,15 @@ class SelectOption extends HTMLElement {
1744
1809
  toggleClasses(this._container, [...disabledClasses, 'smilodon-option--disabled'], false);
1745
1810
  toggleClasses(this, [...disabledClasses, 'smilodon-option--disabled'], false);
1746
1811
  }
1812
+ const interactiveDisabled = Boolean(disabled && (disabledBehavior.hoverable || disabledBehavior.selectable));
1813
+ const toggleBehaviorClass = (className, add) => {
1814
+ toggleClasses(this._container, [className], add);
1815
+ toggleClasses(this, [className], add);
1816
+ };
1817
+ toggleBehaviorClass('smilodon-option--disabled-interactive', interactiveDisabled);
1818
+ toggleBehaviorClass('smilodon-option--disabled-hoverable', Boolean(disabled && disabledBehavior.hoverable));
1819
+ toggleBehaviorClass('smilodon-option--disabled-focusable', Boolean(disabled && disabledBehavior.focusable));
1820
+ toggleBehaviorClass('smilodon-option--disabled-selectable', Boolean(disabled && disabledBehavior.selectable));
1747
1821
  // Custom class name
1748
1822
  if (this._config.className) {
1749
1823
  const classes = this._config.className.split(' ').filter(Boolean);
@@ -1796,7 +1870,7 @@ class SelectOption extends HTMLElement {
1796
1870
  // Set ARIA attributes and State attributes on Host
1797
1871
  this.setAttribute('role', 'option');
1798
1872
  this.setAttribute('aria-selected', String(selected));
1799
- if (disabled) {
1873
+ if (disabled && !disabledBehavior.selectable) {
1800
1874
  this.setAttribute('aria-disabled', 'true');
1801
1875
  }
1802
1876
  else {
@@ -1820,7 +1894,7 @@ class SelectOption extends HTMLElement {
1820
1894
  const state = [];
1821
1895
  if (selected)
1822
1896
  state.push('selected');
1823
- if (active && !disabled)
1897
+ if (active && (!disabled || disabledBehavior.focusable))
1824
1898
  state.push('active');
1825
1899
  if (state.length) {
1826
1900
  this.dataset.smState = state.join(' ');
@@ -1840,7 +1914,7 @@ class SelectOption extends HTMLElement {
1840
1914
  if (e.target === this._removeButton) {
1841
1915
  return;
1842
1916
  }
1843
- if (!this._config.disabled) {
1917
+ if (!this._isDisabledSelectionBlocked()) {
1844
1918
  this._handleSelect();
1845
1919
  }
1846
1920
  });
@@ -1853,7 +1927,7 @@ class SelectOption extends HTMLElement {
1853
1927
  }
1854
1928
  // Keyboard handler
1855
1929
  this.addEventListener('keydown', (e) => {
1856
- if (this._config.disabled)
1930
+ if (this._isDisabledSelectionBlocked())
1857
1931
  return;
1858
1932
  if (e.key === 'Enter' || e.key === ' ') {
1859
1933
  e.preventDefault();
@@ -1944,7 +2018,7 @@ class SelectOption extends HTMLElement {
1944
2018
  * Set active state
1945
2019
  */
1946
2020
  setActive(active) {
1947
- this._config.active = active && !this._config.disabled;
2021
+ this._config.active = active && (!this._config.disabled || this._getDisabledBehavior().focusable);
1948
2022
  this._render();
1949
2023
  }
1950
2024
  /**
@@ -2454,6 +2528,20 @@ class EnhancedSelect extends HTMLElement {
2454
2528
  this._setCssVariable(variableName, styleConfig?.[styleKey]);
2455
2529
  });
2456
2530
  }
2531
+ _getDisabledOptionBehavior() {
2532
+ const behavior = this._config.selection.disabledOptionBehavior ?? {};
2533
+ return {
2534
+ selectable: behavior.selectable === true,
2535
+ hoverable: behavior.hoverable === true,
2536
+ focusable: behavior.focusable === true,
2537
+ };
2538
+ }
2539
+ _isDisabledOptionSelectable(item) {
2540
+ return Boolean(item?.disabled) && this._getDisabledOptionBehavior().selectable;
2541
+ }
2542
+ _isOptionSelectionBlocked(item) {
2543
+ return Boolean(item?.disabled) && !this._isDisabledOptionSelectable(item);
2544
+ }
2457
2545
  _syncStyleConfigVariables() {
2458
2546
  const styles = this._config.styles;
2459
2547
  this._applyStyleVariableMap(styles.option, {
@@ -2511,6 +2599,21 @@ class EnhancedSelect extends HTMLElement {
2511
2599
  opacity: '--select-option-disabled-opacity',
2512
2600
  cursor: '--select-option-disabled-cursor',
2513
2601
  });
2602
+ this._applyStyleVariableMap(styles.selectedIndicator, {
2603
+ width: '--select-option-selected-indicator-width',
2604
+ height: '--select-option-selected-indicator-height',
2605
+ background: '--select-option-selected-indicator-bg',
2606
+ backgroundColor: '--select-option-selected-indicator-bg',
2607
+ borderRadius: '--select-option-selected-indicator-radius',
2608
+ left: '--select-option-selected-indicator-left',
2609
+ right: '--select-option-selected-indicator-right',
2610
+ top: '--select-option-selected-indicator-top',
2611
+ transform: '--select-option-selected-indicator-transform',
2612
+ animation: '--select-option-selected-indicator-animation',
2613
+ });
2614
+ this._setCssVariable('--select-option-selected-indicator-display', this._config.selection.showSelectedIndicator === false
2615
+ ? 'none'
2616
+ : styles.selectedIndicator?.display);
2514
2617
  this._applyStyleVariableMap(styles.badge, {
2515
2618
  width: '--select-badge-width',
2516
2619
  minWidth: '--select-badge-min-width',
@@ -2569,6 +2672,15 @@ class EnhancedSelect extends HTMLElement {
2569
2672
  fontSize: '--select-badge-remove-font-size',
2570
2673
  fontWeight: '--select-badge-remove-font-weight',
2571
2674
  });
2675
+ this._applyStyleVariableMap(styles.badgeRemoveIcon, {
2676
+ width: '--select-badge-remove-icon-size',
2677
+ height: '--select-badge-remove-icon-size',
2678
+ color: '--select-badge-remove-icon-color',
2679
+ fontSize: '--select-badge-remove-icon-font-size',
2680
+ lineHeight: '--select-badge-remove-icon-line-height',
2681
+ transform: '--select-badge-remove-icon-transform',
2682
+ opacity: '--select-badge-remove-icon-opacity',
2683
+ });
2572
2684
  this._applyStyleVariableMap(styles.badgeRemoveHover, {
2573
2685
  background: '--select-badge-remove-hover-bg',
2574
2686
  backgroundColor: '--select-badge-remove-hover-bg',
@@ -2669,11 +2781,24 @@ class EnhancedSelect extends HTMLElement {
2669
2781
  this._inputContainer.style.removeProperty('--select-multi-input-align-content-config');
2670
2782
  return;
2671
2783
  }
2672
- const maxHeight = this._config.multiSelectDisplay?.maxHeight ?? '160px';
2673
- const overflowX = this._config.multiSelectDisplay?.overflowX ?? (mode === 'horizontal' ? 'auto' : 'hidden');
2674
- const overflowY = this._config.multiSelectDisplay?.overflowY ?? (mode === 'horizontal' ? 'hidden' : 'auto');
2675
- const flexWrap = mode === 'horizontal' ? 'nowrap' : 'wrap';
2676
- const alignContent = mode === 'horizontal' ? 'center' : 'flex-start';
2784
+ const configuredMaxHeight = this._config.multiSelectDisplay?.maxHeight;
2785
+ const defaultMaxHeight = '160px';
2786
+ let maxHeight = configuredMaxHeight ?? 'none';
2787
+ let overflowX = this._config.multiSelectDisplay?.overflowX ?? 'hidden';
2788
+ let overflowY = this._config.multiSelectDisplay?.overflowY ?? 'hidden';
2789
+ let flexWrap = 'wrap';
2790
+ let alignContent = 'flex-start';
2791
+ if (mode === 'vertical') {
2792
+ maxHeight = configuredMaxHeight ?? defaultMaxHeight;
2793
+ overflowY = this._config.multiSelectDisplay?.overflowY ?? 'auto';
2794
+ }
2795
+ else if (mode === 'horizontal') {
2796
+ maxHeight = configuredMaxHeight ?? defaultMaxHeight;
2797
+ overflowX = this._config.multiSelectDisplay?.overflowX ?? 'auto';
2798
+ overflowY = this._config.multiSelectDisplay?.overflowY ?? 'hidden';
2799
+ flexWrap = 'nowrap';
2800
+ alignContent = 'center';
2801
+ }
2677
2802
  this._inputContainer.setAttribute('data-multi-scroll-mode', mode);
2678
2803
  this._inputContainer.setAttribute('data-drag-scroll', String(dragEnabled && mode === 'horizontal'));
2679
2804
  this._inputContainer.style.setProperty('--select-multi-input-max-height-config', maxHeight);
@@ -2956,6 +3081,11 @@ class EnhancedSelect extends HTMLElement {
2956
3081
  --select-badge-letter-spacing: 0.01em;
2957
3082
  --select-badge-hover-shadow: var(--select-shadow-md), inset 0 1px 0 rgba(255, 255, 255, 0.15);
2958
3083
  --select-badge-remove-icon-size: 10px;
3084
+ --select-badge-remove-icon-color: currentColor;
3085
+ --select-badge-remove-icon-font-size: inherit;
3086
+ --select-badge-remove-icon-line-height: 1;
3087
+ --select-badge-remove-icon-transform: none;
3088
+ --select-badge-remove-icon-opacity: 1;
2959
3089
  --select-badge-remove-focus-outline: 2px solid rgba(255, 255, 255, 0.5);
2960
3090
  --select-badge-remove-focus-offset: 1px;
2961
3091
  --select-badge-remove-hover-transform: scale(1.15) rotate(90deg);
@@ -2974,9 +3104,11 @@ class EnhancedSelect extends HTMLElement {
2974
3104
  --select-multi-input-overflow-y: auto;
2975
3105
  --select-multi-input-flex-wrap: wrap;
2976
3106
  --select-multi-input-align-content: flex-start;
3107
+ --select-multi-input-horizontal-height: var(--select-input-min-height, 48px);
2977
3108
  --select-multi-input-horizontal-input-flex: 0 0 var(--select-multi-input-min-width, 96px);
2978
3109
  --select-multi-input-horizontal-cursor: grab;
2979
3110
  --select-multi-input-horizontal-active-cursor: grabbing;
3111
+ --select-multi-input-end-gap: 12px;
2980
3112
  --select-multi-separator-inset-block: 10px;
2981
3113
  --select-multi-separator-height: auto;
2982
3114
  --select-multi-action-surface-bg: var(--select-input-bg, var(--select-surface));
@@ -3027,8 +3159,16 @@ class EnhancedSelect extends HTMLElement {
3027
3159
  --select-multi-container-padding: 6px;
3028
3160
  --select-option-disabled-opacity: 0.5;
3029
3161
  --select-option-disabled-cursor: not-allowed;
3162
+ --select-option-active-outline: none;
3030
3163
  --select-option-active-outline-offset: -2px;
3164
+ --select-option-selected-active-bg: 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%)));
3165
+ --select-option-selected-active-color: var(--select-option-selected-hover-color, var(--select-option-selected-color, var(--select-accent)));
3166
+ --select-option-selected-active-border: var(--select-option-selected-hover-border, var(--select-option-selected-border, var(--select-option-border, none)));
3167
+ --select-option-selected-active-shadow: var(--select-option-active-shadow, none);
3168
+ --select-option-selected-active-transform: var(--select-option-active-transform, none);
3169
+ --select-option-selected-active-outline: none;
3031
3170
  --select-option-selected-active-outline-offset: -2px;
3171
+ --select-option-selected-indicator-display: block;
3032
3172
  --select-option-selected-indicator-width: 3px;
3033
3173
  --select-option-selected-indicator-height: 60%;
3034
3174
  --select-option-selected-indicator-bg: var(--select-accent);
@@ -3041,8 +3181,8 @@ class EnhancedSelect extends HTMLElement {
3041
3181
  --select-option-selected-indicator-to-height: 60%;
3042
3182
  --select-option-selected-indicator-from-opacity: 0;
3043
3183
  --select-option-selected-indicator-to-opacity: 1;
3044
- --select-option-pressed-transform: translateX(2px) scale(0.99);
3045
- --select-option-selected-pressed-transform: scale(0.99);
3184
+ --select-option-pressed-transform: none;
3185
+ --select-option-selected-pressed-transform: none;
3046
3186
  --select-button-hover-transform: translateY(-1px);
3047
3187
  --select-button-active-transform: translateY(0) scale(0.98);
3048
3188
  --select-button-font-weight: 550;
@@ -3204,6 +3344,11 @@ class EnhancedSelect extends HTMLElement {
3204
3344
  justify-content: center;
3205
3345
  width: var(--select-badge-remove-icon-size, 10px);
3206
3346
  height: var(--select-badge-remove-icon-size, 10px);
3347
+ color: var(--select-badge-remove-icon-color, currentColor);
3348
+ font-size: var(--select-badge-remove-icon-font-size, inherit);
3349
+ line-height: var(--select-badge-remove-icon-line-height, 1);
3350
+ transform: var(--select-badge-remove-icon-transform, none);
3351
+ opacity: var(--select-badge-remove-icon-opacity, 1);
3207
3352
  pointer-events: none;
3208
3353
  }
3209
3354
 
@@ -3309,13 +3454,26 @@ class EnhancedSelect extends HTMLElement {
3309
3454
 
3310
3455
  .input-container.input-container--multi {
3311
3456
  max-height: var(--select-multi-input-max-height, var(--select-multi-input-max-height-config, var(--select-input-max-height, 160px)));
3457
+ --select-multi-action-area-width: var(--select-arrow-width, 42px);
3312
3458
  }
3313
3459
 
3314
3460
  .input-container.input-container--multi .input-content {
3461
+ flex: 1 1 calc(100% - var(--select-multi-action-area-width, var(--select-arrow-width, 42px)));
3462
+ width: calc(100% - var(--select-multi-action-area-width, var(--select-arrow-width, 42px)));
3463
+ max-width: calc(100% - var(--select-multi-action-area-width, var(--select-arrow-width, 42px)));
3315
3464
  flex-wrap: var(--select-multi-input-flex-wrap, var(--select-multi-input-flex-wrap-config, wrap));
3316
3465
  align-content: var(--select-multi-input-align-content, var(--select-multi-input-align-content-config, flex-start));
3317
3466
  overflow-x: var(--select-multi-input-overflow-x, var(--select-multi-input-overflow-x-config, hidden));
3318
3467
  overflow-y: var(--select-multi-input-overflow-y, var(--select-multi-input-overflow-y-config, auto));
3468
+ padding-inline-end: var(--select-multi-input-end-gap, 12px);
3469
+ }
3470
+
3471
+ .input-container.input-container--multi .input-content .selection-badge {
3472
+ flex: 0 0 auto;
3473
+ }
3474
+
3475
+ .input-container.input-container--multi.has-clear-control .input-content {
3476
+ --select-multi-action-area-width: calc(var(--select-arrow-right-with-clear, 34px) + var(--select-arrow-width, 42px));
3319
3477
  }
3320
3478
 
3321
3479
  .input-container.input-container--multi::after {
@@ -3326,17 +3484,31 @@ class EnhancedSelect extends HTMLElement {
3326
3484
 
3327
3485
  .input-container.input-container--multi[data-multi-scroll-mode="horizontal"] {
3328
3486
  align-items: stretch;
3487
+ height: var(--select-multi-input-horizontal-height, var(--select-input-min-height, 48px));
3488
+ min-height: var(--select-multi-input-horizontal-height, var(--select-input-min-height, 48px));
3489
+ max-height: var(--select-multi-input-horizontal-height, var(--select-input-min-height, 48px));
3490
+ overflow: hidden;
3329
3491
  }
3330
3492
 
3331
3493
  .input-container.input-container--multi[data-multi-scroll-mode="horizontal"] .input-content {
3494
+ flex: 1 1 100%;
3495
+ width: 100%;
3496
+ max-width: 100%;
3497
+ min-height: 0;
3498
+ height: 100%;
3332
3499
  cursor: var(--select-multi-input-horizontal-cursor, grab);
3500
+ align-items: center;
3501
+ align-content: center;
3502
+ flex-wrap: nowrap;
3333
3503
  overflow-y: hidden;
3334
3504
  overscroll-behavior-x: contain;
3335
- padding-right: calc(var(--select-arrow-width, 42px) + var(--select-multi-horizontal-end-gap, 12px));
3505
+ overscroll-behavior-y: none;
3506
+ padding-inline-end: 0;
3507
+ scroll-padding-inline-end: var(--select-multi-action-area-width, var(--select-arrow-width, 42px));
3336
3508
  }
3337
3509
 
3338
3510
  .input-container.input-container--multi[data-multi-scroll-mode="horizontal"].has-clear-control .input-content {
3339
- padding-right: calc(var(--select-arrow-width, 42px) + var(--select-clear-button-size, 26px) + var(--select-clear-button-right, 8px) + var(--select-multi-horizontal-end-gap, 12px));
3511
+ --select-multi-action-area-width: calc(var(--select-arrow-right-with-clear, 34px) + var(--select-arrow-width, 42px));
3340
3512
  }
3341
3513
 
3342
3514
  .input-container.input-container--multi[data-multi-scroll-mode="horizontal"]::after {
@@ -3348,8 +3520,10 @@ class EnhancedSelect extends HTMLElement {
3348
3520
  user-select: none;
3349
3521
  }
3350
3522
 
3351
- .input-container.input-container--multi[data-multi-scroll-mode="horizontal"] .input-content .selection-badge {
3523
+ .input-container.input-container--multi[data-multi-scroll-mode="horizontal"] .selection-badge {
3352
3524
  flex: 0 0 auto;
3525
+ margin-top: 0;
3526
+ margin-bottom: 0;
3353
3527
  }
3354
3528
 
3355
3529
  .input-container.input-container--multi[data-multi-scroll-mode="horizontal"] .input-content > .select-input,
@@ -3378,15 +3552,6 @@ class EnhancedSelect extends HTMLElement {
3378
3552
  left: var(--select-arrow-right-with-clear, 34px);
3379
3553
  }
3380
3554
 
3381
- :host([dir="rtl"]) .input-container.input-container--multi[data-multi-scroll-mode="horizontal"] .input-content {
3382
- padding-right: 0;
3383
- padding-left: calc(var(--select-arrow-width, 42px) + var(--select-multi-horizontal-end-gap, 12px));
3384
- }
3385
-
3386
- :host([dir="rtl"]) .input-container.input-container--multi[data-multi-scroll-mode="horizontal"].has-clear-control .input-content {
3387
- padding-left: calc(var(--select-arrow-width, 42px) + var(--select-clear-button-size, 26px) + var(--select-clear-button-right, 8px) + var(--select-multi-horizontal-end-gap, 12px));
3388
- }
3389
-
3390
3555
  .input-container.input-container--multi[data-multi-scroll-mode="horizontal"] .clear-control-button {
3391
3556
  background: var(--select-multi-action-surface-bg, var(--select-input-bg, var(--select-surface)));
3392
3557
  z-index: 4;
@@ -3775,7 +3940,8 @@ class EnhancedSelect extends HTMLElement {
3775
3940
  margin: var(--select-option-margin);
3776
3941
  }
3777
3942
 
3778
- .option:hover {
3943
+ .option:hover:not(.disabled):not(.smilodon-option--disabled),
3944
+ .option.smilodon-option--disabled-hoverable:hover {
3779
3945
  background: var(--select-option-hover-bg, var(--select-surface-elevated));
3780
3946
  border: var(--select-option-hover-border, var(--select-option-border, none));
3781
3947
  color: var(--select-option-hover-color, var(--select-text));
@@ -3790,7 +3956,8 @@ class EnhancedSelect extends HTMLElement {
3790
3956
  }
3791
3957
 
3792
3958
  .option.selected::before {
3793
- content: '';
3959
+ content: var(--select-option-selected-indicator-content, '');
3960
+ display: var(--select-option-selected-indicator-display, block);
3794
3961
  position: absolute;
3795
3962
  left: var(--select-option-selected-indicator-left);
3796
3963
  top: var(--select-option-selected-indicator-top);
@@ -3825,35 +3992,50 @@ class EnhancedSelect extends HTMLElement {
3825
3992
  color: var(--select-option-selected-hover-color, var(--select-option-selected-color, var(--select-accent)));
3826
3993
  }
3827
3994
 
3828
- .option.active:not(.selected):not(.disabled) {
3995
+ .option.active:not(.selected):not(.disabled):not(.smilodon-option--disabled),
3996
+ .option.active.smilodon-option--disabled-focusable:not(.selected) {
3829
3997
  background: var(--select-option-active-bg, var(--select-surface-elevated));
3830
3998
  color: var(--select-option-active-color, var(--select-option-hover-color, var(--select-option-color, var(--select-text))));
3831
3999
  border: var(--select-option-active-border, var(--select-option-hover-border, var(--select-option-border, none)));
3832
- outline: var(--select-option-active-outline, 2px solid rgba(15, 52, 96, 0.3));
4000
+ outline: var(--select-option-active-outline, none);
3833
4001
  outline-offset: var(--select-option-active-outline-offset);
3834
4002
  box-shadow: var(--select-option-active-shadow, none);
3835
4003
  transform: var(--select-option-active-transform, none);
3836
4004
  }
3837
4005
 
3838
- .option.selected.active:not(.disabled) {
3839
- outline: var(--select-option-selected-active-outline, 2px solid rgba(15, 52, 96, 0.4));
4006
+ .option.selected.active:not(.disabled):not(.smilodon-option--disabled),
4007
+ .option.selected.active.smilodon-option--disabled-focusable {
4008
+ background: var(--select-option-selected-active-bg, 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%))));
4009
+ color: var(--select-option-selected-active-color, var(--select-option-selected-hover-color, var(--select-option-selected-color, var(--select-accent))));
4010
+ border: var(--select-option-selected-active-border, var(--select-option-selected-hover-border, var(--select-option-selected-border, var(--select-option-border, none))));
4011
+ outline: var(--select-option-selected-active-outline, var(--select-option-active-outline, none));
3840
4012
  outline-offset: var(--select-option-selected-active-outline-offset);
4013
+ box-shadow: var(--select-option-selected-active-shadow, var(--select-option-active-shadow, none));
4014
+ transform: var(--select-option-selected-active-transform, var(--select-option-active-transform, none));
3841
4015
  }
3842
4016
 
3843
- .option.disabled {
4017
+ .option.disabled,
4018
+ .option.smilodon-option--disabled {
3844
4019
  background: var(--select-option-disabled-bg, var(--select-option-bg, transparent));
3845
4020
  color: var(--select-option-disabled-color, var(--select-text-muted));
3846
4021
  border: var(--select-option-disabled-border, var(--select-option-border, none));
3847
4022
  opacity: var(--select-option-disabled-opacity, 0.5);
3848
4023
  cursor: var(--select-option-disabled-cursor, not-allowed);
4024
+ pointer-events: var(--select-option-disabled-pointer-events, none);
4025
+ }
4026
+
4027
+ .option.smilodon-option--disabled-interactive {
4028
+ pointer-events: auto;
3849
4029
  }
3850
4030
 
3851
- .option:active:not(.selected) {
4031
+ .option:active:not(.selected):not(.disabled):not(.smilodon-option--disabled),
4032
+ .option.smilodon-option--disabled-selectable:active:not(.selected) {
3852
4033
  background: var(--select-option-pressed-bg, rgba(15, 52, 96, 0.08));
3853
4034
  transform: var(--select-option-pressed-transform);
3854
4035
  }
3855
4036
 
3856
- .option.selected:active {
4037
+ .option.selected:active:not(.disabled):not(.smilodon-option--disabled),
4038
+ .option.selected.smilodon-option--disabled-selectable:active {
3857
4039
  transform: var(--select-option-selected-pressed-transform);
3858
4040
  }
3859
4041
 
@@ -4429,7 +4611,7 @@ class EnhancedSelect extends HTMLElement {
4429
4611
  continue;
4430
4612
  }
4431
4613
  }
4432
- if (option && !option.hasAttribute('aria-disabled')) {
4614
+ if (option && (!option.hasAttribute('aria-disabled') || option.classList.contains('smilodon-option--disabled-selectable'))) {
4433
4615
  const indexStr = option.getAttribute('data-sm-index') ?? option.getAttribute('data-index');
4434
4616
  const index = Number(indexStr);
4435
4617
  if (!Number.isNaN(index)) {
@@ -4873,7 +5055,7 @@ class EnhancedSelect extends HTMLElement {
4873
5055
  }
4874
5056
  _setActive(index) {
4875
5057
  const option = this._getOptionElementByIndex(index);
4876
- if (!option || option.getAttribute('aria-disabled') === 'true') {
5058
+ if (!option || (option.getAttribute('aria-disabled') === 'true' && !option.classList.contains('smilodon-option--disabled-focusable'))) {
4877
5059
  return;
4878
5060
  }
4879
5061
  // Clear previous active state
@@ -4921,7 +5103,7 @@ class EnhancedSelect extends HTMLElement {
4921
5103
  // Only return elements with data-index or data-sm-selectable attributes
4922
5104
  return Array.from(this._optionsContainer.children).filter((child) => {
4923
5105
  return (child.hasAttribute('data-index') || child.hasAttribute('data-sm-selectable'))
4924
- && child.getAttribute('aria-disabled') !== 'true';
5106
+ && (child.getAttribute('aria-disabled') !== 'true' || child.classList.contains('smilodon-option--disabled-focusable'));
4925
5107
  });
4926
5108
  }
4927
5109
  _getSelectableOptionIndices() {
@@ -4976,6 +5158,8 @@ class EnhancedSelect extends HTMLElement {
4976
5158
  // Check if it's a custom SelectOption or a lightweight DOM element
4977
5159
  if ('getConfig' in option && typeof option.getConfig === 'function') {
4978
5160
  const config = option.getConfig();
5161
+ if (this._isOptionSelectionBlocked(config.item))
5162
+ return;
4979
5163
  this._state.selectedIndices.add(optionIndex);
4980
5164
  this._state.selectedItems.set(optionIndex, config.item);
4981
5165
  option.setSelected(true);
@@ -4983,7 +5167,7 @@ class EnhancedSelect extends HTMLElement {
4983
5167
  else {
4984
5168
  // Lightweight option - get item from data attribute or state
4985
5169
  const item = this._state.loadedItems[optionIndex];
4986
- if (item) {
5170
+ if (item && !this._isOptionSelectionBlocked(item)) {
4987
5171
  this._state.selectedIndices.add(optionIndex);
4988
5172
  this._state.selectedItems.set(optionIndex, item);
4989
5173
  option.classList.add('smilodon-option--selected');
@@ -5010,10 +5194,12 @@ class EnhancedSelect extends HTMLElement {
5010
5194
  break;
5011
5195
  const item = this._state.loadedItems[i];
5012
5196
  const optionEl = this._getOptionElementByIndex(i);
5013
- if (optionEl?.getAttribute('aria-disabled') === 'true')
5197
+ if (optionEl?.getAttribute('aria-disabled') === 'true' && !optionEl.classList.contains('smilodon-option--disabled-selectable'))
5014
5198
  continue;
5015
5199
  if (!item)
5016
5200
  continue;
5201
+ if (this._isOptionSelectionBlocked(item))
5202
+ continue;
5017
5203
  this._state.selectedIndices.add(i);
5018
5204
  this._state.selectedItems.set(i, item);
5019
5205
  }
@@ -5051,6 +5237,9 @@ class EnhancedSelect extends HTMLElement {
5051
5237
  if (!item) {
5052
5238
  return;
5053
5239
  }
5240
+ if (this._isOptionSelectionBlocked(item)) {
5241
+ return;
5242
+ }
5054
5243
  const isCurrentlySelected = this._state.selectedIndices.has(index);
5055
5244
  // Keep active/focus styling aligned with the most recently interacted option.
5056
5245
  // Without this, a previously selected item may retain active classes/styles
@@ -5204,6 +5393,9 @@ class EnhancedSelect extends HTMLElement {
5204
5393
  removeBtn.setAttribute('aria-label', `Remove ${getLabel(item)}`);
5205
5394
  const removeIcon = document.createElement('span');
5206
5395
  removeIcon.className = 'badge-remove-icon';
5396
+ if (this._config.styles.classNames?.badgeRemoveIcon) {
5397
+ removeIcon.classList.add(...this._config.styles.classNames.badgeRemoveIcon.split(' ').filter(Boolean));
5398
+ }
5207
5399
  removeIcon.setAttribute('part', 'chip-remove-icon');
5208
5400
  this._setIconContent(removeIcon, this._config.selection.removeButtonIcon, '×');
5209
5401
  removeBtn.appendChild(removeIcon);
@@ -5580,7 +5772,7 @@ class EnhancedSelect extends HTMLElement {
5580
5772
  this._state.selectedIndices.clear();
5581
5773
  this._state.selectedItems.clear();
5582
5774
  this._state.loadedItems.forEach((item, index) => {
5583
- if (values.includes(getValue(item))) {
5775
+ if (values.includes(getValue(item)) && !this._isOptionSelectionBlocked(item)) {
5584
5776
  this._state.selectedIndices.add(index);
5585
5777
  this._state.selectedItems.set(index, item);
5586
5778
  }
@@ -5602,6 +5794,8 @@ class EnhancedSelect extends HTMLElement {
5602
5794
  this._state.selectedIndices.clear();
5603
5795
  this._state.selectedItems.clear();
5604
5796
  items.forEach((item, index) => {
5797
+ if (this._isOptionSelectionBlocked(item))
5798
+ return;
5605
5799
  this._state.selectedIndices.add(index);
5606
5800
  this._state.selectedItems.set(index, item);
5607
5801
  });
@@ -5983,6 +6177,7 @@ class EnhancedSelect extends HTMLElement {
5983
6177
  _renderSingleOption(item, index, getValue, getLabel, targetContainer = this._optionsContainer) {
5984
6178
  const isSelected = this._state.selectedIndices.has(index);
5985
6179
  const isDisabled = Boolean(item?.disabled);
6180
+ const disabledBehavior = this._getDisabledOptionBehavior();
5986
6181
  const optionId = `${this._uniqueId}-option-${index}`;
5987
6182
  if (this._optionRenderer) {
5988
6183
  const rendered = this._optionRenderer(item, index, this._rendererHelpers);
@@ -5994,6 +6189,7 @@ class EnhancedSelect extends HTMLElement {
5994
6189
  selected: isSelected,
5995
6190
  active: this._state.activeIndex === index,
5996
6191
  disabled: isDisabled,
6192
+ disabledBehavior,
5997
6193
  id: optionId,
5998
6194
  });
5999
6195
  optionElement.setAttribute('dir', this._config.direction ?? 'ltr');
@@ -6006,6 +6202,7 @@ class EnhancedSelect extends HTMLElement {
6006
6202
  id: optionId,
6007
6203
  selected: isSelected,
6008
6204
  disabled: isDisabled,
6205
+ disabledBehavior,
6009
6206
  active: this._state.activeIndex === index,
6010
6207
  getValue,
6011
6208
  getLabel,
@@ -6067,6 +6264,10 @@ class EnhancedSelect extends HTMLElement {
6067
6264
  const isSelected = meta.selected;
6068
6265
  const isActive = meta.active;
6069
6266
  const isDisabled = meta.disabled;
6267
+ const isDisabledSelectable = isDisabled && meta.disabledBehavior.selectable;
6268
+ const isDisabledHoverable = isDisabled && meta.disabledBehavior.hoverable;
6269
+ const isDisabledFocusable = isDisabled && meta.disabledBehavior.focusable;
6270
+ const isDisabledInteractive = isDisabled && (isDisabledSelectable || isDisabledHoverable);
6070
6271
  // Resolve classes from classMap or defaults
6071
6272
  const selectedClasses = (this.classMap?.selected ?? 'selected sm-selected').split(' ').filter(Boolean);
6072
6273
  const activeClasses = (this.classMap?.active ?? 'active sm-active').split(' ').filter(Boolean);
@@ -6113,6 +6314,10 @@ class EnhancedSelect extends HTMLElement {
6113
6314
  optionEl.classList.remove(...this._config.styles.classNames.disabledOption.split(' ').filter(Boolean));
6114
6315
  }
6115
6316
  }
6317
+ optionEl.classList.toggle('smilodon-option--disabled-interactive', isDisabledInteractive);
6318
+ optionEl.classList.toggle('smilodon-option--disabled-hoverable', isDisabledHoverable);
6319
+ optionEl.classList.toggle('smilodon-option--disabled-focusable', isDisabledFocusable);
6320
+ optionEl.classList.toggle('smilodon-option--disabled-selectable', isDisabledSelectable);
6116
6321
  // Data Attributes Contract
6117
6322
  const state = [];
6118
6323
  if (isSelected)
@@ -6145,7 +6350,7 @@ class EnhancedSelect extends HTMLElement {
6145
6350
  optionEl.setAttribute('role', 'option');
6146
6351
  }
6147
6352
  optionEl.setAttribute('aria-selected', String(meta.selected));
6148
- if (meta.disabled) {
6353
+ if (meta.disabled && !meta.disabledBehavior.selectable) {
6149
6354
  optionEl.setAttribute('aria-disabled', 'true');
6150
6355
  }
6151
6356
  else {