@smilodon/core 1.5.5 → 1.6.0-debug.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/README.md +138 -8
- package/dist/index.cjs +293 -88
- package/dist/index.cjs.map +1 -1
- package/dist/index.js +293 -88
- package/dist/index.js.map +1 -1
- package/dist/index.min.js +1 -1
- package/dist/index.min.js.map +1 -1
- package/dist/index.umd.js +293 -88
- package/dist/index.umd.js.map +1 -1
- package/dist/index.umd.min.js +1 -1
- package/dist/index.umd.min.js.map +1 -1
- package/dist/types/src/components/enhanced-select.d.ts +3 -0
- package/dist/types/src/components/select-option.d.ts +5 -0
- package/dist/types/src/config/global-config.d.ts +17 -0
- package/package.json +1 -1
package/dist/index.umd.js
CHANGED
|
@@ -1352,8 +1352,14 @@
|
|
|
1352
1352
|
selection: {
|
|
1353
1353
|
mode: 'single',
|
|
1354
1354
|
allowDeselect: false,
|
|
1355
|
+
disabledOptionBehavior: {
|
|
1356
|
+
selectable: false,
|
|
1357
|
+
hoverable: false,
|
|
1358
|
+
focusable: false,
|
|
1359
|
+
},
|
|
1355
1360
|
maxSelections: 0,
|
|
1356
1361
|
showRemoveButton: true,
|
|
1362
|
+
showSelectedIndicator: true,
|
|
1357
1363
|
removeButtonIcon: '×',
|
|
1358
1364
|
closeOnSelect: true,
|
|
1359
1365
|
toggleOnTriggerClick: true,
|
|
@@ -1530,53 +1536,18 @@
|
|
|
1530
1536
|
display: block;
|
|
1531
1537
|
position: relative;
|
|
1532
1538
|
font: inherit;
|
|
1533
|
-
color: inherit;
|
|
1534
|
-
}
|
|
1535
|
-
|
|
1536
|
-
/* Allow authors to style selected state from outside the shadow root
|
|
1537
|
-
by setting attributes/classes on the host element. This mirrors the
|
|
1538
|
-
internal .option-container.selected rules but reads the same CSS
|
|
1539
|
-
custom properties so themes can fully control selected appearance. */
|
|
1540
|
-
:host([aria-selected="true"]) .option-container,
|
|
1541
|
-
:host(.smilodon-option--selected) .option-container {
|
|
1542
|
-
background: var(--select-option-selected-bg, #e3f2fd);
|
|
1543
|
-
color: var(--select-option-selected-color, #1976d2);
|
|
1544
|
-
border: var(--select-option-selected-border, var(--select-option-border, none));
|
|
1545
|
-
border-bottom: var(--select-option-selected-border-bottom, var(--select-option-border-bottom, none));
|
|
1546
|
-
border-radius: var(--select-option-selected-border-radius, var(--select-option-border-radius, 0));
|
|
1547
|
-
box-shadow: var(--select-option-selected-shadow, var(--select-option-shadow, none));
|
|
1548
|
-
transform: var(--select-option-selected-transform, var(--select-option-transform, none));
|
|
1549
|
-
}
|
|
1550
|
-
|
|
1551
|
-
:host([aria-selected="true"]) .option-container:hover,
|
|
1552
|
-
:host(.smilodon-option--selected) .option-container:hover {
|
|
1553
|
-
background: var(--select-option-selected-hover-bg, var(--select-option-selected-bg, #e3f2fd));
|
|
1554
|
-
color: var(--select-option-selected-hover-color, var(--select-option-selected-color, #1976d2));
|
|
1555
|
-
border: var(--select-option-selected-hover-border, var(--select-option-selected-border, var(--select-option-border, none)));
|
|
1556
|
-
border-bottom: var(--select-option-selected-hover-border-bottom, var(--select-option-selected-border-bottom, var(--select-option-border-bottom, none)));
|
|
1557
|
-
box-shadow: var(--select-option-selected-hover-shadow, var(--select-option-selected-shadow, var(--select-option-shadow, none)));
|
|
1558
|
-
transform: var(--select-option-selected-hover-transform, var(--select-option-selected-transform, var(--select-option-transform, none)));
|
|
1559
|
-
}
|
|
1560
|
-
|
|
1561
|
-
.option-container {
|
|
1562
|
-
display: flex;
|
|
1563
|
-
align-items: center;
|
|
1564
|
-
justify-content: space-between;
|
|
1565
|
-
padding: var(--select-option-padding, 10px 14px);
|
|
1566
|
-
cursor: pointer;
|
|
1567
|
-
user-select: none;
|
|
1568
1539
|
color: var(--select-option-color, var(--select-text-color, #1f2937));
|
|
1569
1540
|
background: var(--select-option-bg, var(--select-dropdown-bg, var(--select-bg, white)));
|
|
1570
|
-
transition: var(--select-option-transition, background-color 0.2s ease);
|
|
1571
1541
|
border: var(--select-option-border, none);
|
|
1572
1542
|
border-bottom: var(--select-option-border-bottom, none);
|
|
1573
1543
|
border-radius: var(--select-option-border-radius, var(--select-radius-sm, 6px));
|
|
1574
1544
|
box-shadow: var(--select-option-shadow, none);
|
|
1575
1545
|
transform: var(--select-option-transform, none);
|
|
1576
|
-
|
|
1546
|
+
transition: var(--select-option-transition, background-color 0.2s ease);
|
|
1577
1547
|
}
|
|
1578
|
-
|
|
1579
|
-
.option-
|
|
1548
|
+
|
|
1549
|
+
:host(:hover):not(.smilodon-option--disabled):not([aria-disabled="true"]),
|
|
1550
|
+
:host(.smilodon-option--disabled-hoverable:hover) {
|
|
1580
1551
|
background: var(--select-option-hover-bg, #f0f0f0);
|
|
1581
1552
|
color: var(--select-option-hover-color, var(--select-option-color, var(--select-text-color, #1f2937)));
|
|
1582
1553
|
border: var(--select-option-hover-border, var(--select-option-border, none));
|
|
@@ -1584,8 +1555,12 @@
|
|
|
1584
1555
|
box-shadow: var(--select-option-hover-shadow, var(--select-option-shadow, none));
|
|
1585
1556
|
transform: var(--select-option-hover-transform, var(--select-option-transform, none));
|
|
1586
1557
|
}
|
|
1587
|
-
|
|
1588
|
-
|
|
1558
|
+
|
|
1559
|
+
/* Keep the visual surface on the host so external utility classes applied
|
|
1560
|
+
through classMap can override selected/active/disabled styles in both
|
|
1561
|
+
light and dark themes. */
|
|
1562
|
+
:host([aria-selected="true"]),
|
|
1563
|
+
:host(.smilodon-option--selected) {
|
|
1589
1564
|
background: var(--select-option-selected-bg, #e3f2fd);
|
|
1590
1565
|
color: var(--select-option-selected-color, #1976d2);
|
|
1591
1566
|
border: var(--select-option-selected-border, var(--select-option-border, none));
|
|
@@ -1595,7 +1570,8 @@
|
|
|
1595
1570
|
transform: var(--select-option-selected-transform, var(--select-option-transform, none));
|
|
1596
1571
|
}
|
|
1597
1572
|
|
|
1598
|
-
|
|
1573
|
+
:host([aria-selected="true"]:hover),
|
|
1574
|
+
:host(.smilodon-option--selected:hover) {
|
|
1599
1575
|
background: var(--select-option-selected-hover-bg, var(--select-option-selected-bg, #e3f2fd));
|
|
1600
1576
|
color: var(--select-option-selected-hover-color, var(--select-option-selected-color, #1976d2));
|
|
1601
1577
|
border: var(--select-option-selected-hover-border, var(--select-option-selected-border, var(--select-option-border, none)));
|
|
@@ -1603,18 +1579,20 @@
|
|
|
1603
1579
|
box-shadow: var(--select-option-selected-hover-shadow, var(--select-option-selected-shadow, var(--select-option-shadow, none)));
|
|
1604
1580
|
transform: var(--select-option-selected-hover-transform, var(--select-option-selected-transform, var(--select-option-transform, none)));
|
|
1605
1581
|
}
|
|
1606
|
-
|
|
1607
|
-
.option
|
|
1582
|
+
|
|
1583
|
+
:host(.smilodon-option--active):not(.smilodon-option--disabled):not([aria-disabled="true"]),
|
|
1584
|
+
:host(.smilodon-option--active.smilodon-option--disabled-focusable) {
|
|
1608
1585
|
background: var(--select-option-active-bg, var(--select-option-hover-bg, #f0f0f0));
|
|
1609
1586
|
color: var(--select-option-active-color, var(--select-option-hover-color, var(--select-option-color, var(--select-text-color, #1f2937))));
|
|
1610
1587
|
border: var(--select-option-active-border, var(--select-option-hover-border, var(--select-option-border, none)));
|
|
1611
1588
|
box-shadow: var(--select-option-active-shadow, var(--select-option-shadow, none));
|
|
1612
1589
|
transform: var(--select-option-active-transform, var(--select-option-transform, none));
|
|
1613
|
-
outline: var(--select-option-active-outline,
|
|
1590
|
+
outline: var(--select-option-active-outline, none);
|
|
1614
1591
|
outline-offset: var(--select-option-active-outline-offset, -2px);
|
|
1615
1592
|
}
|
|
1616
|
-
|
|
1617
|
-
.option
|
|
1593
|
+
|
|
1594
|
+
:host(.smilodon-option--disabled),
|
|
1595
|
+
:host([aria-disabled="true"]) {
|
|
1618
1596
|
background: var(--select-option-disabled-bg, var(--select-option-bg, var(--select-dropdown-bg, var(--select-bg, white))));
|
|
1619
1597
|
color: var(--select-option-disabled-color, var(--select-option-color, var(--select-text-color, #1f2937)));
|
|
1620
1598
|
border: var(--select-option-disabled-border, var(--select-option-border, none));
|
|
@@ -1623,6 +1601,76 @@
|
|
|
1623
1601
|
cursor: var(--select-option-disabled-cursor, not-allowed);
|
|
1624
1602
|
pointer-events: none;
|
|
1625
1603
|
}
|
|
1604
|
+
|
|
1605
|
+
:host(.smilodon-option--disabled-interactive) {
|
|
1606
|
+
pointer-events: auto;
|
|
1607
|
+
}
|
|
1608
|
+
|
|
1609
|
+
.option-container {
|
|
1610
|
+
display: flex;
|
|
1611
|
+
align-items: center;
|
|
1612
|
+
justify-content: space-between;
|
|
1613
|
+
padding: var(--select-option-padding, 10px 14px);
|
|
1614
|
+
cursor: pointer;
|
|
1615
|
+
user-select: none;
|
|
1616
|
+
color: inherit;
|
|
1617
|
+
background: inherit;
|
|
1618
|
+
transition: inherit;
|
|
1619
|
+
border: inherit;
|
|
1620
|
+
border-bottom: inherit;
|
|
1621
|
+
border-radius: inherit;
|
|
1622
|
+
box-shadow: inherit;
|
|
1623
|
+
transform: inherit;
|
|
1624
|
+
font: inherit;
|
|
1625
|
+
}
|
|
1626
|
+
|
|
1627
|
+
.option-container:hover {
|
|
1628
|
+
background: inherit;
|
|
1629
|
+
color: inherit;
|
|
1630
|
+
border: inherit;
|
|
1631
|
+
border-bottom: inherit;
|
|
1632
|
+
box-shadow: inherit;
|
|
1633
|
+
transform: inherit;
|
|
1634
|
+
}
|
|
1635
|
+
|
|
1636
|
+
.option-container.selected {
|
|
1637
|
+
background: inherit;
|
|
1638
|
+
color: inherit;
|
|
1639
|
+
border: inherit;
|
|
1640
|
+
border-bottom: inherit;
|
|
1641
|
+
border-radius: inherit;
|
|
1642
|
+
box-shadow: inherit;
|
|
1643
|
+
transform: inherit;
|
|
1644
|
+
}
|
|
1645
|
+
|
|
1646
|
+
.option-container.selected:hover {
|
|
1647
|
+
background: inherit;
|
|
1648
|
+
color: inherit;
|
|
1649
|
+
border: inherit;
|
|
1650
|
+
border-bottom: inherit;
|
|
1651
|
+
box-shadow: inherit;
|
|
1652
|
+
transform: inherit;
|
|
1653
|
+
}
|
|
1654
|
+
|
|
1655
|
+
.option-container.active:not(.disabled) {
|
|
1656
|
+
background: inherit;
|
|
1657
|
+
color: inherit;
|
|
1658
|
+
border: inherit;
|
|
1659
|
+
box-shadow: inherit;
|
|
1660
|
+
transform: inherit;
|
|
1661
|
+
outline: none;
|
|
1662
|
+
outline-offset: 0;
|
|
1663
|
+
}
|
|
1664
|
+
|
|
1665
|
+
.option-container.disabled {
|
|
1666
|
+
background: inherit;
|
|
1667
|
+
color: inherit;
|
|
1668
|
+
border: inherit;
|
|
1669
|
+
border-bottom: inherit;
|
|
1670
|
+
opacity: inherit;
|
|
1671
|
+
cursor: inherit;
|
|
1672
|
+
pointer-events: none;
|
|
1673
|
+
}
|
|
1626
1674
|
|
|
1627
1675
|
.option-content {
|
|
1628
1676
|
flex: 1;
|
|
@@ -1681,6 +1729,11 @@
|
|
|
1681
1729
|
justify-content: center;
|
|
1682
1730
|
width: var(--select-badge-remove-icon-size, 10px);
|
|
1683
1731
|
height: var(--select-badge-remove-icon-size, 10px);
|
|
1732
|
+
color: var(--select-badge-remove-icon-color, currentColor);
|
|
1733
|
+
font-size: var(--select-badge-remove-icon-font-size, inherit);
|
|
1734
|
+
line-height: var(--select-badge-remove-icon-line-height, 1);
|
|
1735
|
+
transform: var(--select-badge-remove-icon-transform, none);
|
|
1736
|
+
opacity: var(--select-badge-remove-icon-opacity, 1);
|
|
1684
1737
|
pointer-events: none;
|
|
1685
1738
|
}
|
|
1686
1739
|
|
|
@@ -1702,8 +1755,20 @@
|
|
|
1702
1755
|
`;
|
|
1703
1756
|
this._shadow.appendChild(style);
|
|
1704
1757
|
}
|
|
1758
|
+
_getDisabledBehavior() {
|
|
1759
|
+
const behavior = this._config.disabledBehavior ?? {};
|
|
1760
|
+
return {
|
|
1761
|
+
selectable: behavior.selectable === true,
|
|
1762
|
+
hoverable: behavior.hoverable === true,
|
|
1763
|
+
focusable: behavior.focusable === true,
|
|
1764
|
+
};
|
|
1765
|
+
}
|
|
1766
|
+
_isDisabledSelectionBlocked() {
|
|
1767
|
+
return Boolean(this._config.disabled) && !this._getDisabledBehavior().selectable;
|
|
1768
|
+
}
|
|
1705
1769
|
_render() {
|
|
1706
1770
|
const { item, index, selected, disabled, active, render, showRemoveButton, classMap } = this._config;
|
|
1771
|
+
const disabledBehavior = this._getDisabledBehavior();
|
|
1707
1772
|
// Clear container
|
|
1708
1773
|
this._container.innerHTML = '';
|
|
1709
1774
|
// Add part attribute
|
|
@@ -1732,7 +1797,7 @@
|
|
|
1732
1797
|
toggleClasses(this._container, [...selectedClasses, 'smilodon-option--selected'], false);
|
|
1733
1798
|
toggleClasses(this, [...selectedClasses, 'smilodon-option--selected'], false);
|
|
1734
1799
|
}
|
|
1735
|
-
if (active && !disabled) {
|
|
1800
|
+
if (active && (!disabled || disabledBehavior.focusable)) {
|
|
1736
1801
|
toggleClasses(this._container, [...activeClasses, 'smilodon-option--active'], true);
|
|
1737
1802
|
toggleClasses(this, [...activeClasses, 'smilodon-option--active'], true); // Make focus ring visible on host
|
|
1738
1803
|
}
|
|
@@ -1748,6 +1813,15 @@
|
|
|
1748
1813
|
toggleClasses(this._container, [...disabledClasses, 'smilodon-option--disabled'], false);
|
|
1749
1814
|
toggleClasses(this, [...disabledClasses, 'smilodon-option--disabled'], false);
|
|
1750
1815
|
}
|
|
1816
|
+
const interactiveDisabled = Boolean(disabled && (disabledBehavior.hoverable || disabledBehavior.selectable));
|
|
1817
|
+
const toggleBehaviorClass = (className, add) => {
|
|
1818
|
+
toggleClasses(this._container, [className], add);
|
|
1819
|
+
toggleClasses(this, [className], add);
|
|
1820
|
+
};
|
|
1821
|
+
toggleBehaviorClass('smilodon-option--disabled-interactive', interactiveDisabled);
|
|
1822
|
+
toggleBehaviorClass('smilodon-option--disabled-hoverable', Boolean(disabled && disabledBehavior.hoverable));
|
|
1823
|
+
toggleBehaviorClass('smilodon-option--disabled-focusable', Boolean(disabled && disabledBehavior.focusable));
|
|
1824
|
+
toggleBehaviorClass('smilodon-option--disabled-selectable', Boolean(disabled && disabledBehavior.selectable));
|
|
1751
1825
|
// Custom class name
|
|
1752
1826
|
if (this._config.className) {
|
|
1753
1827
|
const classes = this._config.className.split(' ').filter(Boolean);
|
|
@@ -1800,7 +1874,7 @@
|
|
|
1800
1874
|
// Set ARIA attributes and State attributes on Host
|
|
1801
1875
|
this.setAttribute('role', 'option');
|
|
1802
1876
|
this.setAttribute('aria-selected', String(selected));
|
|
1803
|
-
if (disabled) {
|
|
1877
|
+
if (disabled && !disabledBehavior.selectable) {
|
|
1804
1878
|
this.setAttribute('aria-disabled', 'true');
|
|
1805
1879
|
}
|
|
1806
1880
|
else {
|
|
@@ -1824,7 +1898,7 @@
|
|
|
1824
1898
|
const state = [];
|
|
1825
1899
|
if (selected)
|
|
1826
1900
|
state.push('selected');
|
|
1827
|
-
if (active && !disabled)
|
|
1901
|
+
if (active && (!disabled || disabledBehavior.focusable))
|
|
1828
1902
|
state.push('active');
|
|
1829
1903
|
if (state.length) {
|
|
1830
1904
|
this.dataset.smState = state.join(' ');
|
|
@@ -1844,7 +1918,7 @@
|
|
|
1844
1918
|
if (e.target === this._removeButton) {
|
|
1845
1919
|
return;
|
|
1846
1920
|
}
|
|
1847
|
-
if (!this.
|
|
1921
|
+
if (!this._isDisabledSelectionBlocked()) {
|
|
1848
1922
|
this._handleSelect();
|
|
1849
1923
|
}
|
|
1850
1924
|
});
|
|
@@ -1857,7 +1931,7 @@
|
|
|
1857
1931
|
}
|
|
1858
1932
|
// Keyboard handler
|
|
1859
1933
|
this.addEventListener('keydown', (e) => {
|
|
1860
|
-
if (this.
|
|
1934
|
+
if (this._isDisabledSelectionBlocked())
|
|
1861
1935
|
return;
|
|
1862
1936
|
if (e.key === 'Enter' || e.key === ' ') {
|
|
1863
1937
|
e.preventDefault();
|
|
@@ -1948,7 +2022,7 @@
|
|
|
1948
2022
|
* Set active state
|
|
1949
2023
|
*/
|
|
1950
2024
|
setActive(active) {
|
|
1951
|
-
this._config.active = active && !this._config.disabled;
|
|
2025
|
+
this._config.active = active && (!this._config.disabled || this._getDisabledBehavior().focusable);
|
|
1952
2026
|
this._render();
|
|
1953
2027
|
}
|
|
1954
2028
|
/**
|
|
@@ -2458,6 +2532,20 @@
|
|
|
2458
2532
|
this._setCssVariable(variableName, styleConfig?.[styleKey]);
|
|
2459
2533
|
});
|
|
2460
2534
|
}
|
|
2535
|
+
_getDisabledOptionBehavior() {
|
|
2536
|
+
const behavior = this._config.selection.disabledOptionBehavior ?? {};
|
|
2537
|
+
return {
|
|
2538
|
+
selectable: behavior.selectable === true,
|
|
2539
|
+
hoverable: behavior.hoverable === true,
|
|
2540
|
+
focusable: behavior.focusable === true,
|
|
2541
|
+
};
|
|
2542
|
+
}
|
|
2543
|
+
_isDisabledOptionSelectable(item) {
|
|
2544
|
+
return Boolean(item?.disabled) && this._getDisabledOptionBehavior().selectable;
|
|
2545
|
+
}
|
|
2546
|
+
_isOptionSelectionBlocked(item) {
|
|
2547
|
+
return Boolean(item?.disabled) && !this._isDisabledOptionSelectable(item);
|
|
2548
|
+
}
|
|
2461
2549
|
_syncStyleConfigVariables() {
|
|
2462
2550
|
const styles = this._config.styles;
|
|
2463
2551
|
this._applyStyleVariableMap(styles.option, {
|
|
@@ -2515,6 +2603,21 @@
|
|
|
2515
2603
|
opacity: '--select-option-disabled-opacity',
|
|
2516
2604
|
cursor: '--select-option-disabled-cursor',
|
|
2517
2605
|
});
|
|
2606
|
+
this._applyStyleVariableMap(styles.selectedIndicator, {
|
|
2607
|
+
width: '--select-option-selected-indicator-width',
|
|
2608
|
+
height: '--select-option-selected-indicator-height',
|
|
2609
|
+
background: '--select-option-selected-indicator-bg',
|
|
2610
|
+
backgroundColor: '--select-option-selected-indicator-bg',
|
|
2611
|
+
borderRadius: '--select-option-selected-indicator-radius',
|
|
2612
|
+
left: '--select-option-selected-indicator-left',
|
|
2613
|
+
right: '--select-option-selected-indicator-right',
|
|
2614
|
+
top: '--select-option-selected-indicator-top',
|
|
2615
|
+
transform: '--select-option-selected-indicator-transform',
|
|
2616
|
+
animation: '--select-option-selected-indicator-animation',
|
|
2617
|
+
});
|
|
2618
|
+
this._setCssVariable('--select-option-selected-indicator-display', this._config.selection.showSelectedIndicator === false
|
|
2619
|
+
? 'none'
|
|
2620
|
+
: styles.selectedIndicator?.display);
|
|
2518
2621
|
this._applyStyleVariableMap(styles.badge, {
|
|
2519
2622
|
width: '--select-badge-width',
|
|
2520
2623
|
minWidth: '--select-badge-min-width',
|
|
@@ -2573,6 +2676,15 @@
|
|
|
2573
2676
|
fontSize: '--select-badge-remove-font-size',
|
|
2574
2677
|
fontWeight: '--select-badge-remove-font-weight',
|
|
2575
2678
|
});
|
|
2679
|
+
this._applyStyleVariableMap(styles.badgeRemoveIcon, {
|
|
2680
|
+
width: '--select-badge-remove-icon-size',
|
|
2681
|
+
height: '--select-badge-remove-icon-size',
|
|
2682
|
+
color: '--select-badge-remove-icon-color',
|
|
2683
|
+
fontSize: '--select-badge-remove-icon-font-size',
|
|
2684
|
+
lineHeight: '--select-badge-remove-icon-line-height',
|
|
2685
|
+
transform: '--select-badge-remove-icon-transform',
|
|
2686
|
+
opacity: '--select-badge-remove-icon-opacity',
|
|
2687
|
+
});
|
|
2576
2688
|
this._applyStyleVariableMap(styles.badgeRemoveHover, {
|
|
2577
2689
|
background: '--select-badge-remove-hover-bg',
|
|
2578
2690
|
backgroundColor: '--select-badge-remove-hover-bg',
|
|
@@ -2673,11 +2785,24 @@
|
|
|
2673
2785
|
this._inputContainer.style.removeProperty('--select-multi-input-align-content-config');
|
|
2674
2786
|
return;
|
|
2675
2787
|
}
|
|
2676
|
-
const
|
|
2677
|
-
const
|
|
2678
|
-
|
|
2679
|
-
|
|
2680
|
-
|
|
2788
|
+
const configuredMaxHeight = this._config.multiSelectDisplay?.maxHeight;
|
|
2789
|
+
const defaultMaxHeight = '160px';
|
|
2790
|
+
let maxHeight = configuredMaxHeight ?? 'none';
|
|
2791
|
+
let overflowX = this._config.multiSelectDisplay?.overflowX ?? 'hidden';
|
|
2792
|
+
let overflowY = this._config.multiSelectDisplay?.overflowY ?? 'hidden';
|
|
2793
|
+
let flexWrap = 'wrap';
|
|
2794
|
+
let alignContent = 'flex-start';
|
|
2795
|
+
if (mode === 'vertical') {
|
|
2796
|
+
maxHeight = configuredMaxHeight ?? defaultMaxHeight;
|
|
2797
|
+
overflowY = this._config.multiSelectDisplay?.overflowY ?? 'auto';
|
|
2798
|
+
}
|
|
2799
|
+
else if (mode === 'horizontal') {
|
|
2800
|
+
maxHeight = configuredMaxHeight ?? defaultMaxHeight;
|
|
2801
|
+
overflowX = this._config.multiSelectDisplay?.overflowX ?? 'auto';
|
|
2802
|
+
overflowY = this._config.multiSelectDisplay?.overflowY ?? 'hidden';
|
|
2803
|
+
flexWrap = 'nowrap';
|
|
2804
|
+
alignContent = 'center';
|
|
2805
|
+
}
|
|
2681
2806
|
this._inputContainer.setAttribute('data-multi-scroll-mode', mode);
|
|
2682
2807
|
this._inputContainer.setAttribute('data-drag-scroll', String(dragEnabled && mode === 'horizontal'));
|
|
2683
2808
|
this._inputContainer.style.setProperty('--select-multi-input-max-height-config', maxHeight);
|
|
@@ -2960,6 +3085,11 @@
|
|
|
2960
3085
|
--select-badge-letter-spacing: 0.01em;
|
|
2961
3086
|
--select-badge-hover-shadow: var(--select-shadow-md), inset 0 1px 0 rgba(255, 255, 255, 0.15);
|
|
2962
3087
|
--select-badge-remove-icon-size: 10px;
|
|
3088
|
+
--select-badge-remove-icon-color: currentColor;
|
|
3089
|
+
--select-badge-remove-icon-font-size: inherit;
|
|
3090
|
+
--select-badge-remove-icon-line-height: 1;
|
|
3091
|
+
--select-badge-remove-icon-transform: none;
|
|
3092
|
+
--select-badge-remove-icon-opacity: 1;
|
|
2963
3093
|
--select-badge-remove-focus-outline: 2px solid rgba(255, 255, 255, 0.5);
|
|
2964
3094
|
--select-badge-remove-focus-offset: 1px;
|
|
2965
3095
|
--select-badge-remove-hover-transform: scale(1.15) rotate(90deg);
|
|
@@ -2978,9 +3108,11 @@
|
|
|
2978
3108
|
--select-multi-input-overflow-y: auto;
|
|
2979
3109
|
--select-multi-input-flex-wrap: wrap;
|
|
2980
3110
|
--select-multi-input-align-content: flex-start;
|
|
3111
|
+
--select-multi-input-horizontal-height: var(--select-input-min-height, 48px);
|
|
2981
3112
|
--select-multi-input-horizontal-input-flex: 0 0 var(--select-multi-input-min-width, 96px);
|
|
2982
3113
|
--select-multi-input-horizontal-cursor: grab;
|
|
2983
3114
|
--select-multi-input-horizontal-active-cursor: grabbing;
|
|
3115
|
+
--select-multi-input-end-gap: 12px;
|
|
2984
3116
|
--select-multi-separator-inset-block: 10px;
|
|
2985
3117
|
--select-multi-separator-height: auto;
|
|
2986
3118
|
--select-multi-action-surface-bg: var(--select-input-bg, var(--select-surface));
|
|
@@ -3031,8 +3163,16 @@
|
|
|
3031
3163
|
--select-multi-container-padding: 6px;
|
|
3032
3164
|
--select-option-disabled-opacity: 0.5;
|
|
3033
3165
|
--select-option-disabled-cursor: not-allowed;
|
|
3166
|
+
--select-option-active-outline: none;
|
|
3034
3167
|
--select-option-active-outline-offset: -2px;
|
|
3168
|
+
--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%)));
|
|
3169
|
+
--select-option-selected-active-color: var(--select-option-selected-hover-color, var(--select-option-selected-color, var(--select-accent)));
|
|
3170
|
+
--select-option-selected-active-border: var(--select-option-selected-hover-border, var(--select-option-selected-border, var(--select-option-border, none)));
|
|
3171
|
+
--select-option-selected-active-shadow: var(--select-option-active-shadow, none);
|
|
3172
|
+
--select-option-selected-active-transform: var(--select-option-active-transform, none);
|
|
3173
|
+
--select-option-selected-active-outline: none;
|
|
3035
3174
|
--select-option-selected-active-outline-offset: -2px;
|
|
3175
|
+
--select-option-selected-indicator-display: block;
|
|
3036
3176
|
--select-option-selected-indicator-width: 3px;
|
|
3037
3177
|
--select-option-selected-indicator-height: 60%;
|
|
3038
3178
|
--select-option-selected-indicator-bg: var(--select-accent);
|
|
@@ -3045,8 +3185,8 @@
|
|
|
3045
3185
|
--select-option-selected-indicator-to-height: 60%;
|
|
3046
3186
|
--select-option-selected-indicator-from-opacity: 0;
|
|
3047
3187
|
--select-option-selected-indicator-to-opacity: 1;
|
|
3048
|
-
--select-option-pressed-transform:
|
|
3049
|
-
--select-option-selected-pressed-transform:
|
|
3188
|
+
--select-option-pressed-transform: none;
|
|
3189
|
+
--select-option-selected-pressed-transform: none;
|
|
3050
3190
|
--select-button-hover-transform: translateY(-1px);
|
|
3051
3191
|
--select-button-active-transform: translateY(0) scale(0.98);
|
|
3052
3192
|
--select-button-font-weight: 550;
|
|
@@ -3208,6 +3348,11 @@
|
|
|
3208
3348
|
justify-content: center;
|
|
3209
3349
|
width: var(--select-badge-remove-icon-size, 10px);
|
|
3210
3350
|
height: var(--select-badge-remove-icon-size, 10px);
|
|
3351
|
+
color: var(--select-badge-remove-icon-color, currentColor);
|
|
3352
|
+
font-size: var(--select-badge-remove-icon-font-size, inherit);
|
|
3353
|
+
line-height: var(--select-badge-remove-icon-line-height, 1);
|
|
3354
|
+
transform: var(--select-badge-remove-icon-transform, none);
|
|
3355
|
+
opacity: var(--select-badge-remove-icon-opacity, 1);
|
|
3211
3356
|
pointer-events: none;
|
|
3212
3357
|
}
|
|
3213
3358
|
|
|
@@ -3313,13 +3458,26 @@
|
|
|
3313
3458
|
|
|
3314
3459
|
.input-container.input-container--multi {
|
|
3315
3460
|
max-height: var(--select-multi-input-max-height, var(--select-multi-input-max-height-config, var(--select-input-max-height, 160px)));
|
|
3461
|
+
--select-multi-action-area-width: var(--select-arrow-width, 42px);
|
|
3316
3462
|
}
|
|
3317
3463
|
|
|
3318
3464
|
.input-container.input-container--multi .input-content {
|
|
3465
|
+
flex: 1 1 calc(100% - var(--select-multi-action-area-width, var(--select-arrow-width, 42px)));
|
|
3466
|
+
width: calc(100% - var(--select-multi-action-area-width, var(--select-arrow-width, 42px)));
|
|
3467
|
+
max-width: calc(100% - var(--select-multi-action-area-width, var(--select-arrow-width, 42px)));
|
|
3319
3468
|
flex-wrap: var(--select-multi-input-flex-wrap, var(--select-multi-input-flex-wrap-config, wrap));
|
|
3320
3469
|
align-content: var(--select-multi-input-align-content, var(--select-multi-input-align-content-config, flex-start));
|
|
3321
3470
|
overflow-x: var(--select-multi-input-overflow-x, var(--select-multi-input-overflow-x-config, hidden));
|
|
3322
3471
|
overflow-y: var(--select-multi-input-overflow-y, var(--select-multi-input-overflow-y-config, auto));
|
|
3472
|
+
padding-inline-end: var(--select-multi-input-end-gap, 12px);
|
|
3473
|
+
}
|
|
3474
|
+
|
|
3475
|
+
.input-container.input-container--multi .input-content .selection-badge {
|
|
3476
|
+
flex: 0 0 auto;
|
|
3477
|
+
}
|
|
3478
|
+
|
|
3479
|
+
.input-container.input-container--multi.has-clear-control .input-content {
|
|
3480
|
+
--select-multi-action-area-width: calc(var(--select-arrow-right-with-clear, 34px) + var(--select-arrow-width, 42px));
|
|
3323
3481
|
}
|
|
3324
3482
|
|
|
3325
3483
|
.input-container.input-container--multi::after {
|
|
@@ -3330,17 +3488,31 @@
|
|
|
3330
3488
|
|
|
3331
3489
|
.input-container.input-container--multi[data-multi-scroll-mode="horizontal"] {
|
|
3332
3490
|
align-items: stretch;
|
|
3491
|
+
height: var(--select-multi-input-horizontal-height, var(--select-input-min-height, 48px));
|
|
3492
|
+
min-height: var(--select-multi-input-horizontal-height, var(--select-input-min-height, 48px));
|
|
3493
|
+
max-height: var(--select-multi-input-horizontal-height, var(--select-input-min-height, 48px));
|
|
3494
|
+
overflow: hidden;
|
|
3333
3495
|
}
|
|
3334
3496
|
|
|
3335
3497
|
.input-container.input-container--multi[data-multi-scroll-mode="horizontal"] .input-content {
|
|
3498
|
+
flex: 1 1 100%;
|
|
3499
|
+
width: 100%;
|
|
3500
|
+
max-width: 100%;
|
|
3501
|
+
min-height: 0;
|
|
3502
|
+
height: 100%;
|
|
3336
3503
|
cursor: var(--select-multi-input-horizontal-cursor, grab);
|
|
3504
|
+
align-items: center;
|
|
3505
|
+
align-content: center;
|
|
3506
|
+
flex-wrap: nowrap;
|
|
3337
3507
|
overflow-y: hidden;
|
|
3338
3508
|
overscroll-behavior-x: contain;
|
|
3339
|
-
|
|
3509
|
+
overscroll-behavior-y: none;
|
|
3510
|
+
padding-inline-end: 0;
|
|
3511
|
+
scroll-padding-inline-end: var(--select-multi-action-area-width, var(--select-arrow-width, 42px));
|
|
3340
3512
|
}
|
|
3341
3513
|
|
|
3342
3514
|
.input-container.input-container--multi[data-multi-scroll-mode="horizontal"].has-clear-control .input-content {
|
|
3343
|
-
|
|
3515
|
+
--select-multi-action-area-width: calc(var(--select-arrow-right-with-clear, 34px) + var(--select-arrow-width, 42px));
|
|
3344
3516
|
}
|
|
3345
3517
|
|
|
3346
3518
|
.input-container.input-container--multi[data-multi-scroll-mode="horizontal"]::after {
|
|
@@ -3352,8 +3524,10 @@
|
|
|
3352
3524
|
user-select: none;
|
|
3353
3525
|
}
|
|
3354
3526
|
|
|
3355
|
-
.input-container.input-container--multi[data-multi-scroll-mode="horizontal"] .
|
|
3527
|
+
.input-container.input-container--multi[data-multi-scroll-mode="horizontal"] .selection-badge {
|
|
3356
3528
|
flex: 0 0 auto;
|
|
3529
|
+
margin-top: 0;
|
|
3530
|
+
margin-bottom: 0;
|
|
3357
3531
|
}
|
|
3358
3532
|
|
|
3359
3533
|
.input-container.input-container--multi[data-multi-scroll-mode="horizontal"] .input-content > .select-input,
|
|
@@ -3382,15 +3556,6 @@
|
|
|
3382
3556
|
left: var(--select-arrow-right-with-clear, 34px);
|
|
3383
3557
|
}
|
|
3384
3558
|
|
|
3385
|
-
:host([dir="rtl"]) .input-container.input-container--multi[data-multi-scroll-mode="horizontal"] .input-content {
|
|
3386
|
-
padding-right: 0;
|
|
3387
|
-
padding-left: calc(var(--select-arrow-width, 42px) + var(--select-multi-horizontal-end-gap, 12px));
|
|
3388
|
-
}
|
|
3389
|
-
|
|
3390
|
-
:host([dir="rtl"]) .input-container.input-container--multi[data-multi-scroll-mode="horizontal"].has-clear-control .input-content {
|
|
3391
|
-
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));
|
|
3392
|
-
}
|
|
3393
|
-
|
|
3394
3559
|
.input-container.input-container--multi[data-multi-scroll-mode="horizontal"] .clear-control-button {
|
|
3395
3560
|
background: var(--select-multi-action-surface-bg, var(--select-input-bg, var(--select-surface)));
|
|
3396
3561
|
z-index: 4;
|
|
@@ -3779,7 +3944,8 @@
|
|
|
3779
3944
|
margin: var(--select-option-margin);
|
|
3780
3945
|
}
|
|
3781
3946
|
|
|
3782
|
-
.option:hover
|
|
3947
|
+
.option:hover:not(.disabled):not(.smilodon-option--disabled),
|
|
3948
|
+
.option.smilodon-option--disabled-hoverable:hover {
|
|
3783
3949
|
background: var(--select-option-hover-bg, var(--select-surface-elevated));
|
|
3784
3950
|
border: var(--select-option-hover-border, var(--select-option-border, none));
|
|
3785
3951
|
color: var(--select-option-hover-color, var(--select-text));
|
|
@@ -3794,7 +3960,8 @@
|
|
|
3794
3960
|
}
|
|
3795
3961
|
|
|
3796
3962
|
.option.selected::before {
|
|
3797
|
-
content: '';
|
|
3963
|
+
content: var(--select-option-selected-indicator-content, '');
|
|
3964
|
+
display: var(--select-option-selected-indicator-display, block);
|
|
3798
3965
|
position: absolute;
|
|
3799
3966
|
left: var(--select-option-selected-indicator-left);
|
|
3800
3967
|
top: var(--select-option-selected-indicator-top);
|
|
@@ -3829,35 +3996,50 @@
|
|
|
3829
3996
|
color: var(--select-option-selected-hover-color, var(--select-option-selected-color, var(--select-accent)));
|
|
3830
3997
|
}
|
|
3831
3998
|
|
|
3832
|
-
.option.active:not(.selected):not(.disabled)
|
|
3999
|
+
.option.active:not(.selected):not(.disabled):not(.smilodon-option--disabled),
|
|
4000
|
+
.option.active.smilodon-option--disabled-focusable:not(.selected) {
|
|
3833
4001
|
background: var(--select-option-active-bg, var(--select-surface-elevated));
|
|
3834
4002
|
color: var(--select-option-active-color, var(--select-option-hover-color, var(--select-option-color, var(--select-text))));
|
|
3835
4003
|
border: var(--select-option-active-border, var(--select-option-hover-border, var(--select-option-border, none)));
|
|
3836
|
-
outline: var(--select-option-active-outline,
|
|
4004
|
+
outline: var(--select-option-active-outline, none);
|
|
3837
4005
|
outline-offset: var(--select-option-active-outline-offset);
|
|
3838
4006
|
box-shadow: var(--select-option-active-shadow, none);
|
|
3839
4007
|
transform: var(--select-option-active-transform, none);
|
|
3840
4008
|
}
|
|
3841
4009
|
|
|
3842
|
-
.option.selected.active:not(.disabled)
|
|
3843
|
-
|
|
4010
|
+
.option.selected.active:not(.disabled):not(.smilodon-option--disabled),
|
|
4011
|
+
.option.selected.active.smilodon-option--disabled-focusable {
|
|
4012
|
+
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%))));
|
|
4013
|
+
color: var(--select-option-selected-active-color, var(--select-option-selected-hover-color, var(--select-option-selected-color, var(--select-accent))));
|
|
4014
|
+
border: var(--select-option-selected-active-border, var(--select-option-selected-hover-border, var(--select-option-selected-border, var(--select-option-border, none))));
|
|
4015
|
+
outline: var(--select-option-selected-active-outline, var(--select-option-active-outline, none));
|
|
3844
4016
|
outline-offset: var(--select-option-selected-active-outline-offset);
|
|
4017
|
+
box-shadow: var(--select-option-selected-active-shadow, var(--select-option-active-shadow, none));
|
|
4018
|
+
transform: var(--select-option-selected-active-transform, var(--select-option-active-transform, none));
|
|
3845
4019
|
}
|
|
3846
4020
|
|
|
3847
|
-
.option.disabled
|
|
4021
|
+
.option.disabled,
|
|
4022
|
+
.option.smilodon-option--disabled {
|
|
3848
4023
|
background: var(--select-option-disabled-bg, var(--select-option-bg, transparent));
|
|
3849
4024
|
color: var(--select-option-disabled-color, var(--select-text-muted));
|
|
3850
4025
|
border: var(--select-option-disabled-border, var(--select-option-border, none));
|
|
3851
4026
|
opacity: var(--select-option-disabled-opacity, 0.5);
|
|
3852
4027
|
cursor: var(--select-option-disabled-cursor, not-allowed);
|
|
4028
|
+
pointer-events: var(--select-option-disabled-pointer-events, none);
|
|
4029
|
+
}
|
|
4030
|
+
|
|
4031
|
+
.option.smilodon-option--disabled-interactive {
|
|
4032
|
+
pointer-events: auto;
|
|
3853
4033
|
}
|
|
3854
4034
|
|
|
3855
|
-
.option:active:not(.selected)
|
|
4035
|
+
.option:active:not(.selected):not(.disabled):not(.smilodon-option--disabled),
|
|
4036
|
+
.option.smilodon-option--disabled-selectable:active:not(.selected) {
|
|
3856
4037
|
background: var(--select-option-pressed-bg, rgba(15, 52, 96, 0.08));
|
|
3857
4038
|
transform: var(--select-option-pressed-transform);
|
|
3858
4039
|
}
|
|
3859
4040
|
|
|
3860
|
-
.option.selected:active
|
|
4041
|
+
.option.selected:active:not(.disabled):not(.smilodon-option--disabled),
|
|
4042
|
+
.option.selected.smilodon-option--disabled-selectable:active {
|
|
3861
4043
|
transform: var(--select-option-selected-pressed-transform);
|
|
3862
4044
|
}
|
|
3863
4045
|
|
|
@@ -4433,7 +4615,7 @@
|
|
|
4433
4615
|
continue;
|
|
4434
4616
|
}
|
|
4435
4617
|
}
|
|
4436
|
-
if (option && !option.hasAttribute('aria-disabled')) {
|
|
4618
|
+
if (option && (!option.hasAttribute('aria-disabled') || option.classList.contains('smilodon-option--disabled-selectable'))) {
|
|
4437
4619
|
const indexStr = option.getAttribute('data-sm-index') ?? option.getAttribute('data-index');
|
|
4438
4620
|
const index = Number(indexStr);
|
|
4439
4621
|
if (!Number.isNaN(index)) {
|
|
@@ -4877,7 +5059,7 @@
|
|
|
4877
5059
|
}
|
|
4878
5060
|
_setActive(index) {
|
|
4879
5061
|
const option = this._getOptionElementByIndex(index);
|
|
4880
|
-
if (!option || option.getAttribute('aria-disabled') === 'true') {
|
|
5062
|
+
if (!option || (option.getAttribute('aria-disabled') === 'true' && !option.classList.contains('smilodon-option--disabled-focusable'))) {
|
|
4881
5063
|
return;
|
|
4882
5064
|
}
|
|
4883
5065
|
// Clear previous active state
|
|
@@ -4925,7 +5107,7 @@
|
|
|
4925
5107
|
// Only return elements with data-index or data-sm-selectable attributes
|
|
4926
5108
|
return Array.from(this._optionsContainer.children).filter((child) => {
|
|
4927
5109
|
return (child.hasAttribute('data-index') || child.hasAttribute('data-sm-selectable'))
|
|
4928
|
-
&& child.getAttribute('aria-disabled') !== 'true';
|
|
5110
|
+
&& (child.getAttribute('aria-disabled') !== 'true' || child.classList.contains('smilodon-option--disabled-focusable'));
|
|
4929
5111
|
});
|
|
4930
5112
|
}
|
|
4931
5113
|
_getSelectableOptionIndices() {
|
|
@@ -4980,6 +5162,8 @@
|
|
|
4980
5162
|
// Check if it's a custom SelectOption or a lightweight DOM element
|
|
4981
5163
|
if ('getConfig' in option && typeof option.getConfig === 'function') {
|
|
4982
5164
|
const config = option.getConfig();
|
|
5165
|
+
if (this._isOptionSelectionBlocked(config.item))
|
|
5166
|
+
return;
|
|
4983
5167
|
this._state.selectedIndices.add(optionIndex);
|
|
4984
5168
|
this._state.selectedItems.set(optionIndex, config.item);
|
|
4985
5169
|
option.setSelected(true);
|
|
@@ -4987,7 +5171,7 @@
|
|
|
4987
5171
|
else {
|
|
4988
5172
|
// Lightweight option - get item from data attribute or state
|
|
4989
5173
|
const item = this._state.loadedItems[optionIndex];
|
|
4990
|
-
if (item) {
|
|
5174
|
+
if (item && !this._isOptionSelectionBlocked(item)) {
|
|
4991
5175
|
this._state.selectedIndices.add(optionIndex);
|
|
4992
5176
|
this._state.selectedItems.set(optionIndex, item);
|
|
4993
5177
|
option.classList.add('smilodon-option--selected');
|
|
@@ -5014,10 +5198,12 @@
|
|
|
5014
5198
|
break;
|
|
5015
5199
|
const item = this._state.loadedItems[i];
|
|
5016
5200
|
const optionEl = this._getOptionElementByIndex(i);
|
|
5017
|
-
if (optionEl?.getAttribute('aria-disabled') === 'true')
|
|
5201
|
+
if (optionEl?.getAttribute('aria-disabled') === 'true' && !optionEl.classList.contains('smilodon-option--disabled-selectable'))
|
|
5018
5202
|
continue;
|
|
5019
5203
|
if (!item)
|
|
5020
5204
|
continue;
|
|
5205
|
+
if (this._isOptionSelectionBlocked(item))
|
|
5206
|
+
continue;
|
|
5021
5207
|
this._state.selectedIndices.add(i);
|
|
5022
5208
|
this._state.selectedItems.set(i, item);
|
|
5023
5209
|
}
|
|
@@ -5055,6 +5241,9 @@
|
|
|
5055
5241
|
if (!item) {
|
|
5056
5242
|
return;
|
|
5057
5243
|
}
|
|
5244
|
+
if (this._isOptionSelectionBlocked(item)) {
|
|
5245
|
+
return;
|
|
5246
|
+
}
|
|
5058
5247
|
const isCurrentlySelected = this._state.selectedIndices.has(index);
|
|
5059
5248
|
// Keep active/focus styling aligned with the most recently interacted option.
|
|
5060
5249
|
// Without this, a previously selected item may retain active classes/styles
|
|
@@ -5208,6 +5397,9 @@
|
|
|
5208
5397
|
removeBtn.setAttribute('aria-label', `Remove ${getLabel(item)}`);
|
|
5209
5398
|
const removeIcon = document.createElement('span');
|
|
5210
5399
|
removeIcon.className = 'badge-remove-icon';
|
|
5400
|
+
if (this._config.styles.classNames?.badgeRemoveIcon) {
|
|
5401
|
+
removeIcon.classList.add(...this._config.styles.classNames.badgeRemoveIcon.split(' ').filter(Boolean));
|
|
5402
|
+
}
|
|
5211
5403
|
removeIcon.setAttribute('part', 'chip-remove-icon');
|
|
5212
5404
|
this._setIconContent(removeIcon, this._config.selection.removeButtonIcon, '×');
|
|
5213
5405
|
removeBtn.appendChild(removeIcon);
|
|
@@ -5584,7 +5776,7 @@
|
|
|
5584
5776
|
this._state.selectedIndices.clear();
|
|
5585
5777
|
this._state.selectedItems.clear();
|
|
5586
5778
|
this._state.loadedItems.forEach((item, index) => {
|
|
5587
|
-
if (values.includes(getValue(item))) {
|
|
5779
|
+
if (values.includes(getValue(item)) && !this._isOptionSelectionBlocked(item)) {
|
|
5588
5780
|
this._state.selectedIndices.add(index);
|
|
5589
5781
|
this._state.selectedItems.set(index, item);
|
|
5590
5782
|
}
|
|
@@ -5606,6 +5798,8 @@
|
|
|
5606
5798
|
this._state.selectedIndices.clear();
|
|
5607
5799
|
this._state.selectedItems.clear();
|
|
5608
5800
|
items.forEach((item, index) => {
|
|
5801
|
+
if (this._isOptionSelectionBlocked(item))
|
|
5802
|
+
return;
|
|
5609
5803
|
this._state.selectedIndices.add(index);
|
|
5610
5804
|
this._state.selectedItems.set(index, item);
|
|
5611
5805
|
});
|
|
@@ -5987,6 +6181,7 @@
|
|
|
5987
6181
|
_renderSingleOption(item, index, getValue, getLabel, targetContainer = this._optionsContainer) {
|
|
5988
6182
|
const isSelected = this._state.selectedIndices.has(index);
|
|
5989
6183
|
const isDisabled = Boolean(item?.disabled);
|
|
6184
|
+
const disabledBehavior = this._getDisabledOptionBehavior();
|
|
5990
6185
|
const optionId = `${this._uniqueId}-option-${index}`;
|
|
5991
6186
|
if (this._optionRenderer) {
|
|
5992
6187
|
const rendered = this._optionRenderer(item, index, this._rendererHelpers);
|
|
@@ -5998,6 +6193,7 @@
|
|
|
5998
6193
|
selected: isSelected,
|
|
5999
6194
|
active: this._state.activeIndex === index,
|
|
6000
6195
|
disabled: isDisabled,
|
|
6196
|
+
disabledBehavior,
|
|
6001
6197
|
id: optionId,
|
|
6002
6198
|
});
|
|
6003
6199
|
optionElement.setAttribute('dir', this._config.direction ?? 'ltr');
|
|
@@ -6010,6 +6206,7 @@
|
|
|
6010
6206
|
id: optionId,
|
|
6011
6207
|
selected: isSelected,
|
|
6012
6208
|
disabled: isDisabled,
|
|
6209
|
+
disabledBehavior,
|
|
6013
6210
|
active: this._state.activeIndex === index,
|
|
6014
6211
|
getValue,
|
|
6015
6212
|
getLabel,
|
|
@@ -6071,6 +6268,10 @@
|
|
|
6071
6268
|
const isSelected = meta.selected;
|
|
6072
6269
|
const isActive = meta.active;
|
|
6073
6270
|
const isDisabled = meta.disabled;
|
|
6271
|
+
const isDisabledSelectable = isDisabled && meta.disabledBehavior.selectable;
|
|
6272
|
+
const isDisabledHoverable = isDisabled && meta.disabledBehavior.hoverable;
|
|
6273
|
+
const isDisabledFocusable = isDisabled && meta.disabledBehavior.focusable;
|
|
6274
|
+
const isDisabledInteractive = isDisabled && (isDisabledSelectable || isDisabledHoverable);
|
|
6074
6275
|
// Resolve classes from classMap or defaults
|
|
6075
6276
|
const selectedClasses = (this.classMap?.selected ?? 'selected sm-selected').split(' ').filter(Boolean);
|
|
6076
6277
|
const activeClasses = (this.classMap?.active ?? 'active sm-active').split(' ').filter(Boolean);
|
|
@@ -6117,6 +6318,10 @@
|
|
|
6117
6318
|
optionEl.classList.remove(...this._config.styles.classNames.disabledOption.split(' ').filter(Boolean));
|
|
6118
6319
|
}
|
|
6119
6320
|
}
|
|
6321
|
+
optionEl.classList.toggle('smilodon-option--disabled-interactive', isDisabledInteractive);
|
|
6322
|
+
optionEl.classList.toggle('smilodon-option--disabled-hoverable', isDisabledHoverable);
|
|
6323
|
+
optionEl.classList.toggle('smilodon-option--disabled-focusable', isDisabledFocusable);
|
|
6324
|
+
optionEl.classList.toggle('smilodon-option--disabled-selectable', isDisabledSelectable);
|
|
6120
6325
|
// Data Attributes Contract
|
|
6121
6326
|
const state = [];
|
|
6122
6327
|
if (isSelected)
|
|
@@ -6149,7 +6354,7 @@
|
|
|
6149
6354
|
optionEl.setAttribute('role', 'option');
|
|
6150
6355
|
}
|
|
6151
6356
|
optionEl.setAttribute('aria-selected', String(meta.selected));
|
|
6152
|
-
if (meta.disabled) {
|
|
6357
|
+
if (meta.disabled && !meta.disabledBehavior.selectable) {
|
|
6153
6358
|
optionEl.setAttribute('aria-disabled', 'true');
|
|
6154
6359
|
}
|
|
6155
6360
|
else {
|