@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/README.md +221 -0
- package/dist/index.cjs +974 -61
- package/dist/index.cjs.map +1 -1
- package/dist/index.js +974 -61
- 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 +974 -61
- 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 +23 -0
- package/dist/types/src/components/select-option.d.ts +2 -0
- package/dist/types/src/config/global-config.d.ts +48 -0
- package/package.json +1 -1
package/dist/index.cjs
CHANGED
|
@@ -1350,9 +1350,21 @@ const defaultConfig = {
|
|
|
1350
1350
|
allowDeselect: false,
|
|
1351
1351
|
maxSelections: 0,
|
|
1352
1352
|
showRemoveButton: true,
|
|
1353
|
+
removeButtonIcon: '×',
|
|
1353
1354
|
closeOnSelect: true,
|
|
1354
1355
|
toggleOnTriggerClick: true,
|
|
1355
1356
|
},
|
|
1357
|
+
direction: 'ltr',
|
|
1358
|
+
dropdownPlacement: {
|
|
1359
|
+
mode: 'bottom',
|
|
1360
|
+
},
|
|
1361
|
+
multiSelectDisplay: {
|
|
1362
|
+
mode: 'wrap',
|
|
1363
|
+
maxHeight: '160px',
|
|
1364
|
+
overflowX: 'hidden',
|
|
1365
|
+
overflowY: 'auto',
|
|
1366
|
+
dragScroll: true,
|
|
1367
|
+
},
|
|
1356
1368
|
scrollToSelected: {
|
|
1357
1369
|
enabled: true,
|
|
1358
1370
|
multiSelectTarget: 'first',
|
|
@@ -1513,6 +1525,8 @@ class SelectOption extends HTMLElement {
|
|
|
1513
1525
|
:host {
|
|
1514
1526
|
display: block;
|
|
1515
1527
|
position: relative;
|
|
1528
|
+
font: inherit;
|
|
1529
|
+
color: inherit;
|
|
1516
1530
|
}
|
|
1517
1531
|
|
|
1518
1532
|
/* Allow authors to style selected state from outside the shadow root
|
|
@@ -1544,7 +1558,7 @@ class SelectOption extends HTMLElement {
|
|
|
1544
1558
|
display: flex;
|
|
1545
1559
|
align-items: center;
|
|
1546
1560
|
justify-content: space-between;
|
|
1547
|
-
padding: var(--select-option-padding,
|
|
1561
|
+
padding: var(--select-option-padding, 10px 14px);
|
|
1548
1562
|
cursor: pointer;
|
|
1549
1563
|
user-select: none;
|
|
1550
1564
|
color: var(--select-option-color, var(--select-text-color, #1f2937));
|
|
@@ -1552,13 +1566,19 @@ class SelectOption extends HTMLElement {
|
|
|
1552
1566
|
transition: var(--select-option-transition, background-color 0.2s ease);
|
|
1553
1567
|
border: var(--select-option-border, none);
|
|
1554
1568
|
border-bottom: var(--select-option-border-bottom, none);
|
|
1555
|
-
border-radius: var(--select-option-border-radius,
|
|
1569
|
+
border-radius: var(--select-option-border-radius, var(--select-radius-sm, 6px));
|
|
1556
1570
|
box-shadow: var(--select-option-shadow, none);
|
|
1557
1571
|
transform: var(--select-option-transform, none);
|
|
1572
|
+
font: inherit;
|
|
1558
1573
|
}
|
|
1559
1574
|
|
|
1560
1575
|
.option-container:hover {
|
|
1561
1576
|
background: var(--select-option-hover-bg, #f0f0f0);
|
|
1577
|
+
color: var(--select-option-hover-color, var(--select-option-color, var(--select-text-color, #1f2937)));
|
|
1578
|
+
border: var(--select-option-hover-border, var(--select-option-border, none));
|
|
1579
|
+
border-bottom: var(--select-option-hover-border-bottom, var(--select-option-border-bottom, none));
|
|
1580
|
+
box-shadow: var(--select-option-hover-shadow, var(--select-option-shadow, none));
|
|
1581
|
+
transform: var(--select-option-hover-transform, var(--select-option-transform, none));
|
|
1562
1582
|
}
|
|
1563
1583
|
|
|
1564
1584
|
.option-container.selected {
|
|
@@ -1581,13 +1601,22 @@ class SelectOption extends HTMLElement {
|
|
|
1581
1601
|
}
|
|
1582
1602
|
|
|
1583
1603
|
.option-container.active {
|
|
1584
|
-
|
|
1585
|
-
|
|
1604
|
+
background: var(--select-option-active-bg, var(--select-option-hover-bg, #f0f0f0));
|
|
1605
|
+
color: var(--select-option-active-color, var(--select-option-hover-color, var(--select-option-color, var(--select-text-color, #1f2937))));
|
|
1606
|
+
border: var(--select-option-active-border, var(--select-option-hover-border, var(--select-option-border, none)));
|
|
1607
|
+
box-shadow: var(--select-option-active-shadow, var(--select-option-shadow, none));
|
|
1608
|
+
transform: var(--select-option-active-transform, var(--select-option-transform, none));
|
|
1609
|
+
outline: var(--select-option-active-outline, 2px solid #1976d2);
|
|
1610
|
+
outline-offset: var(--select-option-active-outline-offset, -2px);
|
|
1586
1611
|
}
|
|
1587
1612
|
|
|
1588
1613
|
.option-container.disabled {
|
|
1589
|
-
|
|
1590
|
-
|
|
1614
|
+
background: var(--select-option-disabled-bg, var(--select-option-bg, var(--select-dropdown-bg, var(--select-bg, white))));
|
|
1615
|
+
color: var(--select-option-disabled-color, var(--select-option-color, var(--select-text-color, #1f2937)));
|
|
1616
|
+
border: var(--select-option-disabled-border, var(--select-option-border, none));
|
|
1617
|
+
border-bottom: var(--select-option-disabled-border-bottom, var(--select-option-border-bottom, none));
|
|
1618
|
+
opacity: var(--select-option-disabled-opacity, 0.5);
|
|
1619
|
+
cursor: var(--select-option-disabled-cursor, not-allowed);
|
|
1591
1620
|
pointer-events: none;
|
|
1592
1621
|
}
|
|
1593
1622
|
|
|
@@ -1604,6 +1633,12 @@ class SelectOption extends HTMLElement {
|
|
|
1604
1633
|
color: var(--select-checkmark-color, currentColor);
|
|
1605
1634
|
}
|
|
1606
1635
|
|
|
1636
|
+
:host([dir="rtl"]) .checkmark-icon,
|
|
1637
|
+
:host-context([dir="rtl"]) .checkmark-icon {
|
|
1638
|
+
margin-left: 0;
|
|
1639
|
+
margin-right: var(--select-checkmark-margin-left, 8px);
|
|
1640
|
+
}
|
|
1641
|
+
|
|
1607
1642
|
:host([aria-selected="true"]) .checkmark-icon,
|
|
1608
1643
|
.option-container.selected .checkmark-icon {
|
|
1609
1644
|
display: inline-flex;
|
|
@@ -1611,20 +1646,49 @@ class SelectOption extends HTMLElement {
|
|
|
1611
1646
|
|
|
1612
1647
|
.remove-button {
|
|
1613
1648
|
margin-left: 8px;
|
|
1614
|
-
|
|
1649
|
+
width: var(--select-badge-remove-size, 18px);
|
|
1650
|
+
height: var(--select-badge-remove-size, 18px);
|
|
1651
|
+
min-width: var(--select-badge-remove-min-width, var(--select-badge-remove-size, 18px));
|
|
1652
|
+
min-height: var(--select-badge-remove-min-height, var(--select-badge-remove-size, 18px));
|
|
1653
|
+
padding: 0;
|
|
1615
1654
|
border: none;
|
|
1616
|
-
background-color: var(--select-remove-
|
|
1617
|
-
color: var(--select-remove-
|
|
1655
|
+
background-color: var(--select-badge-remove-bg, rgba(255, 255, 255, 0.2));
|
|
1656
|
+
color: var(--select-badge-remove-color, currentColor);
|
|
1618
1657
|
cursor: pointer;
|
|
1619
|
-
border-radius:
|
|
1620
|
-
font-size:
|
|
1658
|
+
border-radius: var(--select-badge-remove-radius, 50%);
|
|
1659
|
+
font-size: var(--select-badge-remove-font-size, 0.7333em);
|
|
1660
|
+
font-weight: var(--select-badge-remove-font-weight, 600);
|
|
1621
1661
|
line-height: 1;
|
|
1662
|
+
display: inline-flex;
|
|
1663
|
+
align-items: center;
|
|
1664
|
+
justify-content: center;
|
|
1622
1665
|
transition: all 0.2s ease;
|
|
1623
1666
|
}
|
|
1667
|
+
|
|
1668
|
+
:host([dir="rtl"]) .remove-button,
|
|
1669
|
+
:host-context([dir="rtl"]) .remove-button {
|
|
1670
|
+
margin-left: 0;
|
|
1671
|
+
margin-right: 8px;
|
|
1672
|
+
}
|
|
1673
|
+
|
|
1674
|
+
.remove-button-icon {
|
|
1675
|
+
display: inline-flex;
|
|
1676
|
+
align-items: center;
|
|
1677
|
+
justify-content: center;
|
|
1678
|
+
width: var(--select-badge-remove-icon-size, 10px);
|
|
1679
|
+
height: var(--select-badge-remove-icon-size, 10px);
|
|
1680
|
+
pointer-events: none;
|
|
1681
|
+
}
|
|
1682
|
+
|
|
1683
|
+
.remove-button-icon svg {
|
|
1684
|
+
width: 100%;
|
|
1685
|
+
height: 100%;
|
|
1686
|
+
display: block;
|
|
1687
|
+
}
|
|
1624
1688
|
|
|
1625
1689
|
.remove-button:hover {
|
|
1626
|
-
background-color: var(--select-remove-
|
|
1627
|
-
color: var(--select-remove-
|
|
1690
|
+
background-color: var(--select-badge-remove-hover-bg, #ffebee);
|
|
1691
|
+
color: var(--select-badge-remove-hover-color, #c62828);
|
|
1628
1692
|
}
|
|
1629
1693
|
|
|
1630
1694
|
.remove-button:focus {
|
|
@@ -1711,10 +1775,22 @@ class SelectOption extends HTMLElement {
|
|
|
1711
1775
|
if (showRemoveButton && selected) {
|
|
1712
1776
|
this._removeButton = document.createElement('button');
|
|
1713
1777
|
this._removeButton.className = 'remove-button';
|
|
1714
|
-
this._removeButton.innerHTML = '×';
|
|
1715
1778
|
this._removeButton.setAttribute('part', 'chip-remove');
|
|
1716
1779
|
this._removeButton.setAttribute('aria-label', 'Remove option');
|
|
1717
1780
|
this._removeButton.setAttribute('type', 'button');
|
|
1781
|
+
const removeIcon = document.createElement('span');
|
|
1782
|
+
removeIcon.className = 'remove-button-icon';
|
|
1783
|
+
removeIcon.setAttribute('part', 'chip-remove-icon');
|
|
1784
|
+
const iconMarkup = this._config.removeButtonIcon && this._config.removeButtonIcon.trim()
|
|
1785
|
+
? this._config.removeButtonIcon
|
|
1786
|
+
: '×';
|
|
1787
|
+
if (iconMarkup.trim().startsWith('<')) {
|
|
1788
|
+
removeIcon.innerHTML = iconMarkup;
|
|
1789
|
+
}
|
|
1790
|
+
else {
|
|
1791
|
+
removeIcon.textContent = iconMarkup;
|
|
1792
|
+
}
|
|
1793
|
+
this._removeButton.appendChild(removeIcon);
|
|
1718
1794
|
this._container.appendChild(this._removeButton);
|
|
1719
1795
|
}
|
|
1720
1796
|
// Set ARIA attributes and State attributes on Host
|
|
@@ -1935,6 +2011,16 @@ class EnhancedSelect extends HTMLElement {
|
|
|
1935
2011
|
this._tracking = { events: [], styles: [], limitations: [] };
|
|
1936
2012
|
this._suppressBlurClose = false;
|
|
1937
2013
|
this._renderCycleId = 0;
|
|
2014
|
+
this._suppressNextOpenClick = false;
|
|
2015
|
+
this._resolvedDropdownPlacement = 'bottom';
|
|
2016
|
+
this._multiScrollDrag = {
|
|
2017
|
+
active: false,
|
|
2018
|
+
moved: false,
|
|
2019
|
+
pointerId: -1,
|
|
2020
|
+
startX: 0,
|
|
2021
|
+
startScrollLeft: 0,
|
|
2022
|
+
};
|
|
2023
|
+
this._liftedAncestors = [];
|
|
1938
2024
|
this._shadow = this.attachShadow({ mode: 'open' });
|
|
1939
2025
|
this._uniqueId = `enhanced-select-${Math.random().toString(36).substr(2, 9)}`;
|
|
1940
2026
|
this._rendererHelpers = this._buildRendererHelpers();
|
|
@@ -1962,6 +2048,7 @@ class EnhancedSelect extends HTMLElement {
|
|
|
1962
2048
|
// Create DOM structure
|
|
1963
2049
|
this._container = this._createContainer();
|
|
1964
2050
|
this._inputContainer = this._createInputContainer();
|
|
2051
|
+
this._inputContent = this._createInputContent();
|
|
1965
2052
|
this._input = this._createInput();
|
|
1966
2053
|
this._arrowContainer = this._createArrowContainer();
|
|
1967
2054
|
this._clearControl = this._createClearControl();
|
|
@@ -1970,6 +2057,8 @@ class EnhancedSelect extends HTMLElement {
|
|
|
1970
2057
|
this._liveRegion = this._createLiveRegion();
|
|
1971
2058
|
// Initialize styles BEFORE assembling DOM (order matters in shadow DOM)
|
|
1972
2059
|
this._initializeStyles();
|
|
2060
|
+
this._syncStyleConfigVariables();
|
|
2061
|
+
this._syncDirectionConfig();
|
|
1973
2062
|
this._assembleDOM();
|
|
1974
2063
|
this._attachEventListeners();
|
|
1975
2064
|
this._initializeObservers();
|
|
@@ -2005,6 +2094,7 @@ class EnhancedSelect extends HTMLElement {
|
|
|
2005
2094
|
clearTimeout(this._typeTimeout);
|
|
2006
2095
|
if (this._searchTimeout)
|
|
2007
2096
|
clearTimeout(this._searchTimeout);
|
|
2097
|
+
this._endMultiScrollDrag();
|
|
2008
2098
|
// Cleanup arrow click listener
|
|
2009
2099
|
if (this._boundArrowClick && this._arrowContainer) {
|
|
2010
2100
|
this._arrowContainer.removeEventListener('click', this._boundArrowClick);
|
|
@@ -2138,6 +2228,203 @@ class EnhancedSelect extends HTMLElement {
|
|
|
2138
2228
|
}
|
|
2139
2229
|
return container;
|
|
2140
2230
|
}
|
|
2231
|
+
_createInputContent() {
|
|
2232
|
+
const content = document.createElement('div');
|
|
2233
|
+
content.className = 'input-content';
|
|
2234
|
+
return content;
|
|
2235
|
+
}
|
|
2236
|
+
_setCssVariable(name, value) {
|
|
2237
|
+
if (value == null || value === '') {
|
|
2238
|
+
this.style.removeProperty(name);
|
|
2239
|
+
return;
|
|
2240
|
+
}
|
|
2241
|
+
this.style.setProperty(name, String(value));
|
|
2242
|
+
}
|
|
2243
|
+
_applyStyleVariableMap(styleConfig, variableMap) {
|
|
2244
|
+
Object.entries(variableMap).forEach(([styleKey, variableName]) => {
|
|
2245
|
+
this._setCssVariable(variableName, styleConfig?.[styleKey]);
|
|
2246
|
+
});
|
|
2247
|
+
}
|
|
2248
|
+
_syncStyleConfigVariables() {
|
|
2249
|
+
const styles = this._config.styles;
|
|
2250
|
+
this._applyStyleVariableMap(styles.option, {
|
|
2251
|
+
background: '--select-option-bg',
|
|
2252
|
+
backgroundColor: '--select-option-bg',
|
|
2253
|
+
color: '--select-option-color',
|
|
2254
|
+
border: '--select-option-border',
|
|
2255
|
+
borderBottom: '--select-option-border-bottom',
|
|
2256
|
+
borderRadius: '--select-option-border-radius',
|
|
2257
|
+
boxShadow: '--select-option-shadow',
|
|
2258
|
+
transform: '--select-option-transform',
|
|
2259
|
+
padding: '--select-option-padding',
|
|
2260
|
+
margin: '--select-option-margin',
|
|
2261
|
+
fontSize: '--select-option-font-size',
|
|
2262
|
+
fontWeight: '--select-option-font-weight',
|
|
2263
|
+
lineHeight: '--select-option-line-height',
|
|
2264
|
+
textAlign: '--select-option-text-align',
|
|
2265
|
+
});
|
|
2266
|
+
this._applyStyleVariableMap(styles.selectedOption, {
|
|
2267
|
+
background: '--select-option-selected-bg',
|
|
2268
|
+
backgroundColor: '--select-option-selected-bg',
|
|
2269
|
+
color: '--select-option-selected-color',
|
|
2270
|
+
border: '--select-option-selected-border',
|
|
2271
|
+
borderBottom: '--select-option-selected-border-bottom',
|
|
2272
|
+
borderRadius: '--select-option-selected-border-radius',
|
|
2273
|
+
boxShadow: '--select-option-selected-shadow',
|
|
2274
|
+
transform: '--select-option-selected-transform',
|
|
2275
|
+
fontWeight: '--select-option-selected-weight',
|
|
2276
|
+
});
|
|
2277
|
+
this._applyStyleVariableMap(styles.hoverOption, {
|
|
2278
|
+
background: '--select-option-hover-bg',
|
|
2279
|
+
backgroundColor: '--select-option-hover-bg',
|
|
2280
|
+
color: '--select-option-hover-color',
|
|
2281
|
+
border: '--select-option-hover-border',
|
|
2282
|
+
borderBottom: '--select-option-hover-border-bottom',
|
|
2283
|
+
boxShadow: '--select-option-hover-shadow',
|
|
2284
|
+
transform: '--select-option-hover-transform',
|
|
2285
|
+
});
|
|
2286
|
+
this._applyStyleVariableMap(styles.activeOption, {
|
|
2287
|
+
background: '--select-option-active-bg',
|
|
2288
|
+
backgroundColor: '--select-option-active-bg',
|
|
2289
|
+
color: '--select-option-active-color',
|
|
2290
|
+
border: '--select-option-active-border',
|
|
2291
|
+
outline: '--select-option-active-outline',
|
|
2292
|
+
outlineOffset: '--select-option-active-outline-offset',
|
|
2293
|
+
boxShadow: '--select-option-active-shadow',
|
|
2294
|
+
transform: '--select-option-active-transform',
|
|
2295
|
+
});
|
|
2296
|
+
this._applyStyleVariableMap(styles.disabledOption, {
|
|
2297
|
+
background: '--select-option-disabled-bg',
|
|
2298
|
+
backgroundColor: '--select-option-disabled-bg',
|
|
2299
|
+
color: '--select-option-disabled-color',
|
|
2300
|
+
border: '--select-option-disabled-border',
|
|
2301
|
+
borderBottom: '--select-option-disabled-border-bottom',
|
|
2302
|
+
opacity: '--select-option-disabled-opacity',
|
|
2303
|
+
cursor: '--select-option-disabled-cursor',
|
|
2304
|
+
});
|
|
2305
|
+
this._applyStyleVariableMap(styles.badge, {
|
|
2306
|
+
width: '--select-badge-width',
|
|
2307
|
+
minWidth: '--select-badge-min-width',
|
|
2308
|
+
maxWidth: '--select-badge-max-width',
|
|
2309
|
+
height: '--select-badge-height',
|
|
2310
|
+
minHeight: '--select-badge-min-height',
|
|
2311
|
+
padding: '--select-badge-padding',
|
|
2312
|
+
margin: '--select-badge-margin',
|
|
2313
|
+
gap: '--select-badge-gap',
|
|
2314
|
+
background: '--select-badge-bg',
|
|
2315
|
+
backgroundColor: '--select-badge-bg',
|
|
2316
|
+
color: '--select-badge-color',
|
|
2317
|
+
border: '--select-badge-border',
|
|
2318
|
+
borderRadius: '--select-badge-border-radius',
|
|
2319
|
+
boxShadow: '--select-badge-shadow',
|
|
2320
|
+
fontSize: '--select-badge-font-size',
|
|
2321
|
+
fontWeight: '--select-badge-font-weight',
|
|
2322
|
+
lineHeight: '--select-badge-line-height',
|
|
2323
|
+
letterSpacing: '--select-badge-letter-spacing',
|
|
2324
|
+
});
|
|
2325
|
+
this._applyStyleVariableMap(styles.badgeHover, {
|
|
2326
|
+
background: '--select-badge-hover-bg',
|
|
2327
|
+
backgroundColor: '--select-badge-hover-bg',
|
|
2328
|
+
color: '--select-badge-hover-color',
|
|
2329
|
+
border: '--select-badge-hover-border',
|
|
2330
|
+
boxShadow: '--select-badge-hover-shadow',
|
|
2331
|
+
transform: '--select-badge-hover-transform',
|
|
2332
|
+
});
|
|
2333
|
+
this._applyStyleVariableMap(styles.badgeActive, {
|
|
2334
|
+
background: '--select-badge-active-bg',
|
|
2335
|
+
backgroundColor: '--select-badge-active-bg',
|
|
2336
|
+
color: '--select-badge-active-color',
|
|
2337
|
+
border: '--select-badge-active-border',
|
|
2338
|
+
boxShadow: '--select-badge-active-shadow',
|
|
2339
|
+
transform: '--select-badge-active-transform',
|
|
2340
|
+
});
|
|
2341
|
+
this._applyStyleVariableMap(styles.badgeLabel, {
|
|
2342
|
+
color: '--select-badge-label-color',
|
|
2343
|
+
fontSize: '--select-badge-label-font-size',
|
|
2344
|
+
fontWeight: '--select-badge-label-font-weight',
|
|
2345
|
+
lineHeight: '--select-badge-label-line-height',
|
|
2346
|
+
letterSpacing: '--select-badge-label-letter-spacing',
|
|
2347
|
+
textAlign: '--select-badge-label-text-align',
|
|
2348
|
+
});
|
|
2349
|
+
this._applyStyleVariableMap(styles.badgeRemove, {
|
|
2350
|
+
width: '--select-badge-remove-size',
|
|
2351
|
+
height: '--select-badge-remove-size',
|
|
2352
|
+
minWidth: '--select-badge-remove-min-width',
|
|
2353
|
+
minHeight: '--select-badge-remove-min-height',
|
|
2354
|
+
marginLeft: '--select-badge-remove-margin-left',
|
|
2355
|
+
background: '--select-badge-remove-bg',
|
|
2356
|
+
backgroundColor: '--select-badge-remove-bg',
|
|
2357
|
+
border: '--select-badge-remove-border',
|
|
2358
|
+
borderRadius: '--select-badge-remove-radius',
|
|
2359
|
+
color: '--select-badge-remove-color',
|
|
2360
|
+
fontSize: '--select-badge-remove-font-size',
|
|
2361
|
+
fontWeight: '--select-badge-remove-font-weight',
|
|
2362
|
+
});
|
|
2363
|
+
this._applyStyleVariableMap(styles.badgeRemoveHover, {
|
|
2364
|
+
background: '--select-badge-remove-hover-bg',
|
|
2365
|
+
backgroundColor: '--select-badge-remove-hover-bg',
|
|
2366
|
+
color: '--select-badge-remove-hover-color',
|
|
2367
|
+
border: '--select-badge-remove-hover-border',
|
|
2368
|
+
boxShadow: '--select-badge-remove-hover-shadow',
|
|
2369
|
+
transform: '--select-badge-remove-hover-transform',
|
|
2370
|
+
});
|
|
2371
|
+
this._applyStyleVariableMap(styles.badgeRemoveActive, {
|
|
2372
|
+
background: '--select-badge-remove-active-bg',
|
|
2373
|
+
backgroundColor: '--select-badge-remove-active-bg',
|
|
2374
|
+
color: '--select-badge-remove-active-color',
|
|
2375
|
+
border: '--select-badge-remove-active-border',
|
|
2376
|
+
boxShadow: '--select-badge-remove-active-shadow',
|
|
2377
|
+
transform: '--select-badge-remove-active-transform',
|
|
2378
|
+
});
|
|
2379
|
+
this._applyStyleVariableMap(styles.groupHeader, {
|
|
2380
|
+
padding: '--select-group-header-padding',
|
|
2381
|
+
margin: '--select-group-header-margin',
|
|
2382
|
+
color: '--select-group-header-color',
|
|
2383
|
+
background: '--select-group-header-bg',
|
|
2384
|
+
backgroundColor: '--select-group-header-bg',
|
|
2385
|
+
border: '--select-group-header-border',
|
|
2386
|
+
borderBottom: '--select-group-header-border-bottom',
|
|
2387
|
+
borderRadius: '--select-group-header-border-radius',
|
|
2388
|
+
boxShadow: '--select-group-header-shadow',
|
|
2389
|
+
textAlign: '--select-group-header-text-align',
|
|
2390
|
+
fontSize: '--select-group-header-font-size',
|
|
2391
|
+
fontWeight: '--select-group-header-weight',
|
|
2392
|
+
textTransform: '--select-group-header-text-transform',
|
|
2393
|
+
letterSpacing: '--select-group-header-letter-spacing',
|
|
2394
|
+
});
|
|
2395
|
+
}
|
|
2396
|
+
_resolveDropdownPlacement() {
|
|
2397
|
+
const placementMode = this._config.dropdownPlacement?.mode ?? 'bottom';
|
|
2398
|
+
if (placementMode === 'bottom' || placementMode === 'top') {
|
|
2399
|
+
return placementMode;
|
|
2400
|
+
}
|
|
2401
|
+
const hostRect = this._container.getBoundingClientRect();
|
|
2402
|
+
const availableBelow = window.innerHeight - hostRect.bottom;
|
|
2403
|
+
const computedDropdown = window.getComputedStyle(this._dropdown);
|
|
2404
|
+
const maxHeight = Number.parseFloat(computedDropdown.maxHeight || '0');
|
|
2405
|
+
const desiredHeight = Number.isFinite(maxHeight) && maxHeight > 0
|
|
2406
|
+
? Math.min(this._dropdown.scrollHeight, maxHeight)
|
|
2407
|
+
: this._dropdown.scrollHeight;
|
|
2408
|
+
return availableBelow >= desiredHeight ? 'bottom' : 'top';
|
|
2409
|
+
}
|
|
2410
|
+
_syncDropdownPlacement() {
|
|
2411
|
+
if (!this._dropdown)
|
|
2412
|
+
return;
|
|
2413
|
+
this._resolvedDropdownPlacement = this._resolveDropdownPlacement();
|
|
2414
|
+
this._dropdown.setAttribute('data-placement', this._resolvedDropdownPlacement);
|
|
2415
|
+
}
|
|
2416
|
+
_syncDirectionConfig() {
|
|
2417
|
+
this.setAttribute('dir', this._config.direction ?? 'ltr');
|
|
2418
|
+
}
|
|
2419
|
+
_setIconContent(target, markup, fallback) {
|
|
2420
|
+
const content = markup && markup.trim() ? markup : fallback;
|
|
2421
|
+
target.innerHTML = '';
|
|
2422
|
+
if (content.trim().startsWith('<')) {
|
|
2423
|
+
target.innerHTML = content;
|
|
2424
|
+
return;
|
|
2425
|
+
}
|
|
2426
|
+
target.textContent = content;
|
|
2427
|
+
}
|
|
2141
2428
|
_syncInputContainerMode() {
|
|
2142
2429
|
if (!this._inputContainer || !this._input)
|
|
2143
2430
|
return;
|
|
@@ -2154,6 +2441,121 @@ class EnhancedSelect extends HTMLElement {
|
|
|
2154
2441
|
this._input.style.width = '100%';
|
|
2155
2442
|
this._input.style.minWidth = '0';
|
|
2156
2443
|
}
|
|
2444
|
+
this._syncMultiSelectDisplayConfig();
|
|
2445
|
+
}
|
|
2446
|
+
_syncMultiSelectDisplayConfig() {
|
|
2447
|
+
if (!this._inputContainer || !this._input)
|
|
2448
|
+
return;
|
|
2449
|
+
const isMulti = this._config.selection.mode === 'multi';
|
|
2450
|
+
const mode = this._config.multiSelectDisplay?.mode ?? 'wrap';
|
|
2451
|
+
const dragEnabled = this._config.multiSelectDisplay?.dragScroll !== false;
|
|
2452
|
+
if (!isMulti) {
|
|
2453
|
+
this._inputContainer.removeAttribute('data-multi-scroll-mode');
|
|
2454
|
+
this._inputContainer.removeAttribute('data-drag-scroll');
|
|
2455
|
+
this._inputContainer.classList.remove('is-dragging-scroll');
|
|
2456
|
+
this._inputContainer.style.removeProperty('--select-multi-input-max-height');
|
|
2457
|
+
this._inputContainer.style.removeProperty('--select-multi-input-overflow-x');
|
|
2458
|
+
this._inputContainer.style.removeProperty('--select-multi-input-overflow-y');
|
|
2459
|
+
this._inputContainer.style.removeProperty('--select-multi-input-flex-wrap');
|
|
2460
|
+
this._inputContainer.style.removeProperty('--select-multi-input-align-content');
|
|
2461
|
+
return;
|
|
2462
|
+
}
|
|
2463
|
+
const maxHeight = this._config.multiSelectDisplay?.maxHeight ?? '160px';
|
|
2464
|
+
const overflowX = this._config.multiSelectDisplay?.overflowX ?? (mode === 'horizontal' ? 'auto' : 'hidden');
|
|
2465
|
+
const overflowY = this._config.multiSelectDisplay?.overflowY ?? (mode === 'horizontal' ? 'hidden' : 'auto');
|
|
2466
|
+
const flexWrap = mode === 'horizontal' ? 'nowrap' : 'wrap';
|
|
2467
|
+
const alignContent = mode === 'horizontal' ? 'center' : 'flex-start';
|
|
2468
|
+
this._inputContainer.setAttribute('data-multi-scroll-mode', mode);
|
|
2469
|
+
this._inputContainer.setAttribute('data-drag-scroll', String(dragEnabled && mode === 'horizontal'));
|
|
2470
|
+
this._inputContainer.style.setProperty('--select-multi-input-max-height', maxHeight);
|
|
2471
|
+
this._inputContainer.style.setProperty('--select-multi-input-overflow-x', overflowX);
|
|
2472
|
+
this._inputContainer.style.setProperty('--select-multi-input-overflow-y', overflowY);
|
|
2473
|
+
this._inputContainer.style.setProperty('--select-multi-input-flex-wrap', flexWrap);
|
|
2474
|
+
this._inputContainer.style.setProperty('--select-multi-input-align-content', alignContent);
|
|
2475
|
+
}
|
|
2476
|
+
_canUseHorizontalMultiScroll(target) {
|
|
2477
|
+
if (this._config.selection.mode !== 'multi')
|
|
2478
|
+
return false;
|
|
2479
|
+
if ((this._config.multiSelectDisplay?.mode ?? 'wrap') !== 'horizontal')
|
|
2480
|
+
return false;
|
|
2481
|
+
if (this._config.multiSelectDisplay?.dragScroll === false)
|
|
2482
|
+
return false;
|
|
2483
|
+
if (!target)
|
|
2484
|
+
return true;
|
|
2485
|
+
if (target.closest('.dropdown-arrow-container, .clear-control-button, .badge-remove'))
|
|
2486
|
+
return false;
|
|
2487
|
+
if (target.matches('.select-input'))
|
|
2488
|
+
return false;
|
|
2489
|
+
return true;
|
|
2490
|
+
}
|
|
2491
|
+
_isScrollableMultiSelectMode() {
|
|
2492
|
+
if (this._config.selection.mode !== 'multi')
|
|
2493
|
+
return false;
|
|
2494
|
+
const mode = this._config.multiSelectDisplay?.mode ?? 'wrap';
|
|
2495
|
+
return mode === 'vertical' || mode === 'horizontal';
|
|
2496
|
+
}
|
|
2497
|
+
_isPointerOnInputScrollbar(event) {
|
|
2498
|
+
if (!this._isScrollableMultiSelectMode())
|
|
2499
|
+
return false;
|
|
2500
|
+
const rect = this._inputContent.getBoundingClientRect();
|
|
2501
|
+
const verticalScrollbarWidth = this._inputContent.offsetWidth - this._inputContent.clientWidth;
|
|
2502
|
+
const horizontalScrollbarHeight = this._inputContent.offsetHeight - this._inputContent.clientHeight;
|
|
2503
|
+
if (verticalScrollbarWidth > 0
|
|
2504
|
+
&& event.clientX >= rect.right - verticalScrollbarWidth
|
|
2505
|
+
&& event.clientX <= rect.right
|
|
2506
|
+
&& event.clientY >= rect.top
|
|
2507
|
+
&& event.clientY <= rect.bottom) {
|
|
2508
|
+
return true;
|
|
2509
|
+
}
|
|
2510
|
+
if (horizontalScrollbarHeight > 0
|
|
2511
|
+
&& event.clientY >= rect.bottom - horizontalScrollbarHeight
|
|
2512
|
+
&& event.clientY <= rect.bottom
|
|
2513
|
+
&& event.clientX >= rect.left
|
|
2514
|
+
&& event.clientX <= rect.right) {
|
|
2515
|
+
return true;
|
|
2516
|
+
}
|
|
2517
|
+
return false;
|
|
2518
|
+
}
|
|
2519
|
+
_beginMultiScrollDrag(e) {
|
|
2520
|
+
const scrollHost = this._inputContent;
|
|
2521
|
+
this._multiScrollDrag.active = true;
|
|
2522
|
+
this._multiScrollDrag.moved = false;
|
|
2523
|
+
this._multiScrollDrag.pointerId = e.pointerId;
|
|
2524
|
+
this._multiScrollDrag.startX = e.clientX;
|
|
2525
|
+
this._multiScrollDrag.startScrollLeft = scrollHost.scrollLeft;
|
|
2526
|
+
this._inputContainer.classList.add('is-dragging-scroll');
|
|
2527
|
+
try {
|
|
2528
|
+
scrollHost.setPointerCapture(e.pointerId);
|
|
2529
|
+
}
|
|
2530
|
+
catch (_error) {
|
|
2531
|
+
// ignore pointer capture issues
|
|
2532
|
+
}
|
|
2533
|
+
}
|
|
2534
|
+
_updateMultiScrollDrag(e) {
|
|
2535
|
+
if (!this._multiScrollDrag.active || this._multiScrollDrag.pointerId !== e.pointerId)
|
|
2536
|
+
return;
|
|
2537
|
+
const deltaX = e.clientX - this._multiScrollDrag.startX;
|
|
2538
|
+
if (Math.abs(deltaX) > 3) {
|
|
2539
|
+
this._multiScrollDrag.moved = true;
|
|
2540
|
+
}
|
|
2541
|
+
this._inputContent.scrollLeft = this._multiScrollDrag.startScrollLeft - deltaX;
|
|
2542
|
+
}
|
|
2543
|
+
_endMultiScrollDrag(pointerId) {
|
|
2544
|
+
if (!this._multiScrollDrag.active)
|
|
2545
|
+
return;
|
|
2546
|
+
if (pointerId != null && this._multiScrollDrag.pointerId !== pointerId)
|
|
2547
|
+
return;
|
|
2548
|
+
try {
|
|
2549
|
+
if (this._multiScrollDrag.pointerId >= 0) {
|
|
2550
|
+
this._inputContent.releasePointerCapture(this._multiScrollDrag.pointerId);
|
|
2551
|
+
}
|
|
2552
|
+
}
|
|
2553
|
+
catch (_error) {
|
|
2554
|
+
// ignore pointer capture issues
|
|
2555
|
+
}
|
|
2556
|
+
this._multiScrollDrag.active = false;
|
|
2557
|
+
this._multiScrollDrag.pointerId = -1;
|
|
2558
|
+
this._inputContainer.classList.remove('is-dragging-scroll');
|
|
2157
2559
|
}
|
|
2158
2560
|
_createInput() {
|
|
2159
2561
|
const input = document.createElement('input');
|
|
@@ -2282,7 +2684,8 @@ class EnhancedSelect extends HTMLElement {
|
|
|
2282
2684
|
return button;
|
|
2283
2685
|
}
|
|
2284
2686
|
_assembleDOM() {
|
|
2285
|
-
this.
|
|
2687
|
+
this._inputContent.appendChild(this._input);
|
|
2688
|
+
this._inputContainer.appendChild(this._inputContent);
|
|
2286
2689
|
if (this._clearControl) {
|
|
2287
2690
|
this._inputContainer.appendChild(this._clearControl);
|
|
2288
2691
|
}
|
|
@@ -2339,9 +2742,11 @@ class EnhancedSelect extends HTMLElement {
|
|
|
2339
2742
|
--select-badge-enter-from-transform: scale(0.8) translateY(-4px);
|
|
2340
2743
|
--select-badge-enter-to-opacity: 1;
|
|
2341
2744
|
--select-badge-enter-to-transform: scale(1) translateY(0);
|
|
2745
|
+
--select-badge-active-transform: scale(0.98);
|
|
2342
2746
|
--select-badge-hover-transform: scale(1.02);
|
|
2343
2747
|
--select-badge-letter-spacing: 0.01em;
|
|
2344
2748
|
--select-badge-hover-shadow: var(--select-shadow-md), inset 0 1px 0 rgba(255, 255, 255, 0.15);
|
|
2749
|
+
--select-badge-remove-icon-size: 10px;
|
|
2345
2750
|
--select-badge-remove-focus-outline: 2px solid rgba(255, 255, 255, 0.5);
|
|
2346
2751
|
--select-badge-remove-focus-offset: 1px;
|
|
2347
2752
|
--select-badge-remove-hover-transform: scale(1.15) rotate(90deg);
|
|
@@ -2351,8 +2756,31 @@ class EnhancedSelect extends HTMLElement {
|
|
|
2351
2756
|
--select-input-font-weight: 450;
|
|
2352
2757
|
--select-input-letter-spacing: 0.01em;
|
|
2353
2758
|
--select-input-disabled-opacity: 0.6;
|
|
2759
|
+
--select-input-overflow-x: hidden;
|
|
2760
|
+
--select-input-align-items: center;
|
|
2761
|
+
--select-input-align-content: center;
|
|
2762
|
+
--select-input-align-self: center;
|
|
2763
|
+
--select-multi-input-max-height: 160px;
|
|
2764
|
+
--select-multi-input-overflow-x: hidden;
|
|
2765
|
+
--select-multi-input-overflow-y: auto;
|
|
2766
|
+
--select-multi-input-flex-wrap: wrap;
|
|
2767
|
+
--select-multi-input-align-content: flex-start;
|
|
2768
|
+
--select-multi-input-horizontal-input-flex: 0 0 var(--select-multi-input-min-width, 96px);
|
|
2769
|
+
--select-multi-input-horizontal-cursor: grab;
|
|
2770
|
+
--select-multi-input-horizontal-active-cursor: grabbing;
|
|
2771
|
+
--select-multi-separator-inset-block: 10px;
|
|
2772
|
+
--select-multi-action-surface-bg: var(--select-input-bg, var(--select-surface));
|
|
2773
|
+
--select-multi-action-divider: 1px solid var(--select-border);
|
|
2774
|
+
--select-separator-width: 1px;
|
|
2775
|
+
--select-separator-height: 50%;
|
|
2776
|
+
--select-separator-display: block;
|
|
2354
2777
|
--select-separator-opacity: 0.6;
|
|
2355
2778
|
--select-separator-active-opacity: 1;
|
|
2779
|
+
--select-separator-width: 1px;
|
|
2780
|
+
--select-separator-height: 50%;
|
|
2781
|
+
--select-separator-display: block;
|
|
2782
|
+
--select-separator-position: var(--select-arrow-width, 42px);
|
|
2783
|
+
--select-separator-position-with-clear: calc(var(--select-arrow-right-with-clear, 34px) + var(--select-arrow-width, 42px));
|
|
2356
2784
|
--select-separator-dark-bg: linear-gradient(
|
|
2357
2785
|
to bottom,
|
|
2358
2786
|
transparent 0%,
|
|
@@ -2366,18 +2794,31 @@ class EnhancedSelect extends HTMLElement {
|
|
|
2366
2794
|
--select-clear-button-focus-offset: 2px;
|
|
2367
2795
|
--select-clear-icon-size: 14px;
|
|
2368
2796
|
--select-dropdown-top: calc(100% + 6px);
|
|
2797
|
+
--select-dropdown-bottom: calc(100% + 6px);
|
|
2369
2798
|
--select-dropdown-animation: dropdownEnter 200ms cubic-bezier(0.4, 0, 0.2, 1) forwards;
|
|
2370
2799
|
--select-dropdown-enter-from-opacity: 0;
|
|
2371
2800
|
--select-dropdown-enter-from-transform: translateY(-8px) scale(0.98);
|
|
2372
2801
|
--select-dropdown-enter-to-opacity: 1;
|
|
2373
2802
|
--select-dropdown-enter-to-transform: translateY(0) scale(1);
|
|
2803
|
+
--select-dropdown-top-transform-origin: bottom center;
|
|
2804
|
+
--select-dropdown-top-enter-from-transform: translateY(8px) scale(0.98);
|
|
2805
|
+
--select-dropdown-padding: 6px;
|
|
2374
2806
|
--select-dropdown-scroll-behavior: smooth;
|
|
2375
2807
|
--select-dropdown-transform-origin: top center;
|
|
2376
2808
|
--select-scrollbar-width: 6px;
|
|
2377
2809
|
--select-scrollbar-thumb-radius: 3px;
|
|
2810
|
+
--select-option-hover-enabled: 1;
|
|
2378
2811
|
--select-option-hover-transform: translateX(2px);
|
|
2379
2812
|
--select-option-font-weight: 450;
|
|
2380
2813
|
--select-option-margin: 2px 0;
|
|
2814
|
+
--select-input-font-size: inherit;
|
|
2815
|
+
--select-input-font-weight: 400;
|
|
2816
|
+
--select-multi-container-padding: 6px;
|
|
2817
|
+
--select-input-font-size: inherit;
|
|
2818
|
+
--select-input-font-weight: 400;
|
|
2819
|
+
--select-multi-container-padding: 6px;
|
|
2820
|
+
--select-option-disabled-opacity: 0.5;
|
|
2821
|
+
--select-option-disabled-cursor: not-allowed;
|
|
2381
2822
|
--select-option-active-outline-offset: -2px;
|
|
2382
2823
|
--select-option-selected-active-outline-offset: -2px;
|
|
2383
2824
|
--select-option-selected-indicator-width: 3px;
|
|
@@ -2419,12 +2860,31 @@ class EnhancedSelect extends HTMLElement {
|
|
|
2419
2860
|
--select-high-contrast-focus-outline-color: Highlight;
|
|
2420
2861
|
--select-touch-target-min-height: 44px;
|
|
2421
2862
|
--select-badge-dark-bg: linear-gradient(135deg, var(--select-accent) 0%, #4f46e5 100%);
|
|
2863
|
+
--select-host-z-index: auto;
|
|
2864
|
+
--select-host-open-z-index: var(--select-dropdown-z-index, 1000);
|
|
2865
|
+
--select-ancestor-open-z-index: var(--select-host-open-z-index, var(--select-dropdown-z-index, 1000));
|
|
2422
2866
|
|
|
2423
2867
|
display: block;
|
|
2424
2868
|
position: relative;
|
|
2869
|
+
z-index: var(--select-host-z-index, auto);
|
|
2425
2870
|
width: var(--select-width, 100%);
|
|
2426
2871
|
height: var(--select-height, auto);
|
|
2427
|
-
font-family: var(--select-font-family,
|
|
2872
|
+
font-family: var(--select-font-family, inherit);
|
|
2873
|
+
font-size: var(--select-font-size, inherit);
|
|
2874
|
+
line-height: var(--select-line-height, inherit);
|
|
2875
|
+
color: var(--select-color, inherit);
|
|
2876
|
+
}
|
|
2877
|
+
|
|
2878
|
+
:host([data-open="true"]) {
|
|
2879
|
+
z-index: var(--select-host-open-z-index, var(--select-dropdown-z-index, 1000));
|
|
2880
|
+
}
|
|
2881
|
+
|
|
2882
|
+
:host([dir="ltr"]) {
|
|
2883
|
+
direction: ltr;
|
|
2884
|
+
}
|
|
2885
|
+
|
|
2886
|
+
:host([dir="rtl"]) {
|
|
2887
|
+
direction: rtl;
|
|
2428
2888
|
}
|
|
2429
2889
|
|
|
2430
2890
|
/* ─────────────────────────────────────────────────────────────────────────
|
|
@@ -2436,6 +2896,9 @@ class EnhancedSelect extends HTMLElement {
|
|
|
2436
2896
|
align-items: center;
|
|
2437
2897
|
gap: var(--select-badge-gap, 6px);
|
|
2438
2898
|
flex: 0 1 auto;
|
|
2899
|
+
width: var(--select-badge-width, auto);
|
|
2900
|
+
min-width: var(--select-badge-min-width, 0);
|
|
2901
|
+
height: var(--select-badge-height, auto);
|
|
2439
2902
|
min-height: var(--select-badge-min-height, 26px);
|
|
2440
2903
|
padding: var(--select-badge-padding, 4px 10px 4px 12px);
|
|
2441
2904
|
margin: var(--select-badge-margin, 3px);
|
|
@@ -2445,7 +2908,7 @@ class EnhancedSelect extends HTMLElement {
|
|
|
2445
2908
|
border-radius: var(--select-badge-border-radius, 999px);
|
|
2446
2909
|
box-shadow: var(--select-badge-shadow, var(--select-shadow-sm), inset 0 1px 0 rgba(255, 255, 255, 0.1));
|
|
2447
2910
|
box-sizing: border-box;
|
|
2448
|
-
font-size: var(--select-badge-font-size,
|
|
2911
|
+
font-size: var(--select-badge-font-size, 0.8667em);
|
|
2449
2912
|
font-weight: var(--select-badge-font-weight, 500);
|
|
2450
2913
|
line-height: var(--select-badge-line-height, 1.2);
|
|
2451
2914
|
letter-spacing: var(--select-badge-letter-spacing);
|
|
@@ -2471,17 +2934,33 @@ class EnhancedSelect extends HTMLElement {
|
|
|
2471
2934
|
}
|
|
2472
2935
|
|
|
2473
2936
|
.selection-badge:hover {
|
|
2937
|
+
background: var(--select-badge-hover-bg, var(--select-badge-bg, linear-gradient(135deg, var(--select-accent) 0%, var(--select-primary-light) 100%)));
|
|
2938
|
+
color: var(--select-badge-hover-color, var(--select-badge-color, #ffffff));
|
|
2939
|
+
border: var(--select-badge-hover-border, var(--select-badge-border, none));
|
|
2474
2940
|
box-shadow: var(--select-badge-hover-shadow);
|
|
2475
2941
|
transform: var(--select-badge-hover-transform);
|
|
2476
2942
|
}
|
|
2477
2943
|
|
|
2944
|
+
.selection-badge:active {
|
|
2945
|
+
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%))));
|
|
2946
|
+
color: var(--select-badge-active-color, var(--select-badge-hover-color, var(--select-badge-color, #ffffff)));
|
|
2947
|
+
border: var(--select-badge-active-border, var(--select-badge-hover-border, var(--select-badge-border, none)));
|
|
2948
|
+
box-shadow: var(--select-badge-active-shadow, var(--select-badge-hover-shadow));
|
|
2949
|
+
transform: var(--select-badge-active-transform);
|
|
2950
|
+
}
|
|
2951
|
+
|
|
2478
2952
|
.selection-badge-label {
|
|
2479
2953
|
display: block;
|
|
2480
2954
|
min-width: 0;
|
|
2481
2955
|
overflow: hidden;
|
|
2482
2956
|
text-overflow: ellipsis;
|
|
2483
2957
|
white-space: nowrap;
|
|
2484
|
-
|
|
2958
|
+
color: var(--select-badge-label-color, inherit);
|
|
2959
|
+
font-size: var(--select-badge-label-font-size, inherit);
|
|
2960
|
+
font-weight: var(--select-badge-label-font-weight, inherit);
|
|
2961
|
+
line-height: var(--select-badge-label-line-height, var(--select-badge-line-height, 1.2));
|
|
2962
|
+
letter-spacing: var(--select-badge-label-letter-spacing, inherit);
|
|
2963
|
+
text-align: var(--select-badge-label-text-align, start);
|
|
2485
2964
|
}
|
|
2486
2965
|
|
|
2487
2966
|
.badge-remove {
|
|
@@ -2490,24 +2969,47 @@ class EnhancedSelect extends HTMLElement {
|
|
|
2490
2969
|
justify-content: center;
|
|
2491
2970
|
width: var(--select-badge-remove-size, 18px);
|
|
2492
2971
|
height: var(--select-badge-remove-size, 18px);
|
|
2972
|
+
min-width: var(--select-badge-remove-min-width, var(--select-badge-remove-size, 18px));
|
|
2973
|
+
min-height: var(--select-badge-remove-min-height, var(--select-badge-remove-size, 18px));
|
|
2493
2974
|
padding: 0;
|
|
2494
2975
|
margin-left: var(--select-badge-remove-margin-left);
|
|
2495
2976
|
background: var(--select-badge-remove-bg, rgba(255, 255, 255, 0.2));
|
|
2496
2977
|
border: var(--select-badge-remove-border, none);
|
|
2497
2978
|
border-radius: var(--select-badge-remove-radius);
|
|
2498
2979
|
color: var(--select-badge-remove-color, #ffffff);
|
|
2499
|
-
font-size: var(--select-badge-remove-font-size,
|
|
2980
|
+
font-size: var(--select-badge-remove-font-size, 0.7333em);
|
|
2500
2981
|
font-weight: var(--select-badge-remove-font-weight);
|
|
2501
2982
|
line-height: 1;
|
|
2502
2983
|
cursor: pointer;
|
|
2503
2984
|
flex: 0 0 auto;
|
|
2504
2985
|
transition:
|
|
2505
2986
|
background var(--select-transition-fast),
|
|
2987
|
+
color var(--select-transition-fast),
|
|
2988
|
+
border-color var(--select-transition-fast),
|
|
2989
|
+
box-shadow var(--select-transition-fast),
|
|
2506
2990
|
transform var(--select-transition-bounce);
|
|
2507
2991
|
}
|
|
2992
|
+
|
|
2993
|
+
.badge-remove-icon {
|
|
2994
|
+
display: inline-flex;
|
|
2995
|
+
align-items: center;
|
|
2996
|
+
justify-content: center;
|
|
2997
|
+
width: var(--select-badge-remove-icon-size, 10px);
|
|
2998
|
+
height: var(--select-badge-remove-icon-size, 10px);
|
|
2999
|
+
pointer-events: none;
|
|
3000
|
+
}
|
|
3001
|
+
|
|
3002
|
+
.badge-remove-icon svg {
|
|
3003
|
+
width: 100%;
|
|
3004
|
+
height: 100%;
|
|
3005
|
+
display: block;
|
|
3006
|
+
}
|
|
2508
3007
|
|
|
2509
3008
|
.badge-remove:hover {
|
|
2510
3009
|
background: var(--select-badge-remove-hover-bg, rgba(233, 69, 96, 0.9));
|
|
3010
|
+
color: var(--select-badge-remove-hover-color, var(--select-badge-remove-color, #ffffff));
|
|
3011
|
+
border: var(--select-badge-remove-hover-border, var(--select-badge-remove-border, none));
|
|
3012
|
+
box-shadow: var(--select-badge-remove-hover-shadow, none);
|
|
2511
3013
|
transform: var(--select-badge-remove-hover-transform);
|
|
2512
3014
|
}
|
|
2513
3015
|
|
|
@@ -2517,8 +3019,17 @@ class EnhancedSelect extends HTMLElement {
|
|
|
2517
3019
|
}
|
|
2518
3020
|
|
|
2519
3021
|
.badge-remove:active {
|
|
3022
|
+
background: var(--select-badge-remove-active-bg, var(--select-badge-remove-hover-bg, rgba(233, 69, 96, 0.9)));
|
|
3023
|
+
color: var(--select-badge-remove-active-color, var(--select-badge-remove-hover-color, var(--select-badge-remove-color, #ffffff)));
|
|
3024
|
+
border: var(--select-badge-remove-active-border, var(--select-badge-remove-hover-border, var(--select-badge-remove-border, none)));
|
|
3025
|
+
box-shadow: var(--select-badge-remove-active-shadow, var(--select-badge-remove-hover-shadow, none));
|
|
2520
3026
|
transform: var(--select-badge-remove-active-transform);
|
|
2521
3027
|
}
|
|
3028
|
+
|
|
3029
|
+
:host([dir="rtl"]) .badge-remove {
|
|
3030
|
+
margin-left: 0;
|
|
3031
|
+
margin-right: var(--select-badge-remove-margin-left);
|
|
3032
|
+
}
|
|
2522
3033
|
|
|
2523
3034
|
/* ─────────────────────────────────────────────────────────────────────────
|
|
2524
3035
|
Input Container — Sophisticated control shell
|
|
@@ -2533,16 +3044,22 @@ class EnhancedSelect extends HTMLElement {
|
|
|
2533
3044
|
position: relative;
|
|
2534
3045
|
width: 100%;
|
|
2535
3046
|
display: flex;
|
|
2536
|
-
align-items: center;
|
|
3047
|
+
align-items: var(--select-input-align-items, center);
|
|
2537
3048
|
flex-wrap: nowrap;
|
|
3049
|
+
justify-content: var(--select-input-justify-content, flex-start);
|
|
2538
3050
|
gap: var(--select-input-gap, 6px);
|
|
2539
3051
|
padding: var(--select-input-padding, 10px 52px 10px 14px);
|
|
2540
3052
|
height: var(--select-input-height, auto);
|
|
2541
3053
|
min-height: var(--select-input-min-height, 48px);
|
|
2542
3054
|
max-height: var(--select-input-max-height, 160px);
|
|
2543
|
-
overflow
|
|
2544
|
-
|
|
3055
|
+
overflow: hidden;
|
|
3056
|
+
padding: var(--select-multi-container-padding, 6px);
|
|
3057
|
+
align-content: var(--select-input-align-content, center);
|
|
3058
|
+
text-align: var(--select-input-text-align, start);
|
|
2545
3059
|
background: var(--select-input-bg, var(--select-surface));
|
|
3060
|
+
font-size: var(--select-input-font-size, inherit);
|
|
3061
|
+
font-weight: var(--select-input-font-weight, 400);
|
|
3062
|
+
font-weight: var(--select-input-font-weight, 400);
|
|
2546
3063
|
border: var(--select-input-border, 1.5px solid var(--select-border));
|
|
2547
3064
|
border-radius: var(--select-input-border-radius, var(--select-radius-md));
|
|
2548
3065
|
box-shadow: var(--select-shadow-sm);
|
|
@@ -2552,6 +3069,25 @@ class EnhancedSelect extends HTMLElement {
|
|
|
2552
3069
|
box-shadow var(--select-transition-smooth),
|
|
2553
3070
|
transform var(--select-transition-fast);
|
|
2554
3071
|
}
|
|
3072
|
+
|
|
3073
|
+
.input-content {
|
|
3074
|
+
position: relative;
|
|
3075
|
+
display: flex;
|
|
3076
|
+
flex: 1 1 auto;
|
|
3077
|
+
width: 100%;
|
|
3078
|
+
min-width: 0;
|
|
3079
|
+
min-height: 0;
|
|
3080
|
+
align-self: stretch;
|
|
3081
|
+
align-items: var(--select-input-align-items, center);
|
|
3082
|
+
align-content: var(--select-input-align-content, center);
|
|
3083
|
+
justify-content: var(--select-input-justify-content, flex-start);
|
|
3084
|
+
flex-wrap: nowrap;
|
|
3085
|
+
gap: var(--select-input-gap, 6px);
|
|
3086
|
+
overflow-x: var(--select-input-overflow-x, hidden);
|
|
3087
|
+
overflow-y: var(--select-input-overflow-y, hidden);
|
|
3088
|
+
scrollbar-width: thin;
|
|
3089
|
+
box-sizing: border-box;
|
|
3090
|
+
}
|
|
2555
3091
|
|
|
2556
3092
|
.input-container:hover {
|
|
2557
3093
|
border-color: var(--select-input-hover-border);
|
|
@@ -2564,8 +3100,75 @@ class EnhancedSelect extends HTMLElement {
|
|
|
2564
3100
|
}
|
|
2565
3101
|
|
|
2566
3102
|
.input-container.input-container--multi {
|
|
2567
|
-
|
|
2568
|
-
|
|
3103
|
+
max-height: var(--select-multi-input-max-height, var(--select-input-max-height, 160px));
|
|
3104
|
+
}
|
|
3105
|
+
|
|
3106
|
+
.input-container.input-container--multi .input-content {
|
|
3107
|
+
flex-wrap: var(--select-multi-input-flex-wrap, wrap);
|
|
3108
|
+
align-content: var(--select-multi-input-align-content, flex-start);
|
|
3109
|
+
overflow-x: var(--select-multi-input-overflow-x, hidden);
|
|
3110
|
+
overflow-y: var(--select-multi-input-overflow-y, auto);
|
|
3111
|
+
}
|
|
3112
|
+
|
|
3113
|
+
.input-container.input-container--multi::after {
|
|
3114
|
+
top: var(--select-multi-separator-inset-block, 10px);
|
|
3115
|
+
bottom: var(--select-multi-separator-inset-block, 10px);
|
|
3116
|
+
height: auto;
|
|
3117
|
+
transform: none;
|
|
3118
|
+
}
|
|
3119
|
+
|
|
3120
|
+
.input-container.input-container--multi[data-multi-scroll-mode="horizontal"] {
|
|
3121
|
+
align-items: stretch;
|
|
3122
|
+
}
|
|
3123
|
+
|
|
3124
|
+
.input-container.input-container--multi[data-multi-scroll-mode="horizontal"] .input-content {
|
|
3125
|
+
cursor: var(--select-multi-input-horizontal-cursor, grab);
|
|
3126
|
+
overflow-y: hidden;
|
|
3127
|
+
overscroll-behavior-x: contain;
|
|
3128
|
+
}
|
|
3129
|
+
|
|
3130
|
+
.input-container.input-container--multi[data-multi-scroll-mode="horizontal"]::after {
|
|
3131
|
+
display: none;
|
|
3132
|
+
}
|
|
3133
|
+
|
|
3134
|
+
.input-container.input-container--multi[data-multi-scroll-mode="horizontal"].is-dragging-scroll .input-content {
|
|
3135
|
+
cursor: var(--select-multi-input-horizontal-active-cursor, grabbing);
|
|
3136
|
+
user-select: none;
|
|
3137
|
+
}
|
|
3138
|
+
|
|
3139
|
+
.input-container.input-container--multi[data-multi-scroll-mode="horizontal"] .input-content .selection-badge {
|
|
3140
|
+
flex: 0 0 auto;
|
|
3141
|
+
}
|
|
3142
|
+
|
|
3143
|
+
.input-container.input-container--multi[data-multi-scroll-mode="horizontal"] .input-content > .select-input,
|
|
3144
|
+
.input-container.input-container--multi[data-multi-scroll-mode="horizontal"] .input-content > input.select-input,
|
|
3145
|
+
.input-container.input-container--multi[data-multi-scroll-mode="horizontal"] .input-content > .select-input[type="text"] {
|
|
3146
|
+
flex: var(--select-multi-input-horizontal-input-flex, 0 0 var(--select-multi-input-min-width, 96px));
|
|
3147
|
+
}
|
|
3148
|
+
|
|
3149
|
+
.input-container.input-container--multi[data-multi-scroll-mode="horizontal"] .dropdown-arrow-container {
|
|
3150
|
+
background: var(--select-multi-action-surface-bg, var(--select-input-bg, var(--select-surface)));
|
|
3151
|
+
border-left: var(--select-multi-action-divider, 1px solid var(--select-border));
|
|
3152
|
+
z-index: 4;
|
|
3153
|
+
}
|
|
3154
|
+
|
|
3155
|
+
.input-container.input-container--multi[data-multi-scroll-mode="horizontal"] .dropdown-arrow-container.with-clear-control {
|
|
3156
|
+
right: var(--select-arrow-right-with-clear, 34px);
|
|
3157
|
+
}
|
|
3158
|
+
|
|
3159
|
+
:host([dir="rtl"]) .input-container.input-container--multi[data-multi-scroll-mode="horizontal"] .dropdown-arrow-container {
|
|
3160
|
+
border-left: none;
|
|
3161
|
+
border-right: var(--select-multi-action-divider, 1px solid var(--select-border));
|
|
3162
|
+
}
|
|
3163
|
+
|
|
3164
|
+
:host([dir="rtl"]) .input-container.input-container--multi[data-multi-scroll-mode="horizontal"] .dropdown-arrow-container.with-clear-control {
|
|
3165
|
+
right: auto;
|
|
3166
|
+
left: var(--select-arrow-right-with-clear, 34px);
|
|
3167
|
+
}
|
|
3168
|
+
|
|
3169
|
+
.input-container.input-container--multi[data-multi-scroll-mode="horizontal"] .clear-control-button {
|
|
3170
|
+
background: var(--select-multi-action-surface-bg, var(--select-input-bg, var(--select-surface)));
|
|
3171
|
+
z-index: 4;
|
|
2569
3172
|
}
|
|
2570
3173
|
|
|
2571
3174
|
.input-container:focus-within {
|
|
@@ -2576,9 +3179,10 @@ class EnhancedSelect extends HTMLElement {
|
|
|
2576
3179
|
/* Elegant separator line before arrow */
|
|
2577
3180
|
.input-container::after {
|
|
2578
3181
|
content: '';
|
|
3182
|
+
display: var(--select-separator-display, block);
|
|
2579
3183
|
position: absolute;
|
|
2580
3184
|
top: 50%;
|
|
2581
|
-
right: var(--select-separator-position, 42px);
|
|
3185
|
+
right: var(--select-separator-position, var(--select-arrow-width, 42px));
|
|
2582
3186
|
transform: translateY(-50%);
|
|
2583
3187
|
width: var(--select-separator-width, 1px);
|
|
2584
3188
|
height: var(--select-separator-height, 50%);
|
|
@@ -2599,6 +3203,11 @@ class EnhancedSelect extends HTMLElement {
|
|
|
2599
3203
|
.input-container:focus-within::after {
|
|
2600
3204
|
opacity: var(--select-separator-active-opacity);
|
|
2601
3205
|
}
|
|
3206
|
+
|
|
3207
|
+
:host([dir="rtl"]) .input-container::after {
|
|
3208
|
+
right: auto;
|
|
3209
|
+
left: var(--select-separator-position, var(--select-arrow-width, 42px));
|
|
3210
|
+
}
|
|
2602
3211
|
|
|
2603
3212
|
/* ─────────────────────────────────────────────────────────────────────────
|
|
2604
3213
|
Dropdown Arrow — Smooth rotation with refined styling
|
|
@@ -2625,13 +3234,29 @@ class EnhancedSelect extends HTMLElement {
|
|
|
2625
3234
|
}
|
|
2626
3235
|
|
|
2627
3236
|
.input-container.has-clear-control::after {
|
|
2628
|
-
right: var(--select-separator-position-with-clear,
|
|
3237
|
+
right: var(--select-separator-position-with-clear, calc(var(--select-arrow-right-with-clear, 34px) + var(--select-arrow-width, 42px)));
|
|
2629
3238
|
}
|
|
2630
3239
|
|
|
2631
3240
|
.dropdown-arrow-container.with-clear-control {
|
|
2632
3241
|
right: var(--select-arrow-right-with-clear, 34px);
|
|
2633
3242
|
}
|
|
2634
3243
|
|
|
3244
|
+
:host([dir="rtl"]) .dropdown-arrow-container {
|
|
3245
|
+
right: auto;
|
|
3246
|
+
left: 0;
|
|
3247
|
+
border-radius: var(--select-arrow-border-radius-rtl, var(--select-radius-md) 0 0 var(--select-radius-md));
|
|
3248
|
+
}
|
|
3249
|
+
|
|
3250
|
+
:host([dir="rtl"]) .input-container.has-clear-control::after {
|
|
3251
|
+
right: auto;
|
|
3252
|
+
left: var(--select-separator-position-with-clear, calc(var(--select-arrow-right-with-clear, 34px) + var(--select-arrow-width, 42px)));
|
|
3253
|
+
}
|
|
3254
|
+
|
|
3255
|
+
:host([dir="rtl"]) .dropdown-arrow-container.with-clear-control {
|
|
3256
|
+
right: auto;
|
|
3257
|
+
left: var(--select-arrow-right-with-clear, 34px);
|
|
3258
|
+
}
|
|
3259
|
+
|
|
2635
3260
|
/* ─────────────────────────────────────────────────────────────────────────
|
|
2636
3261
|
Clear Control — Minimal and elegant dismiss button
|
|
2637
3262
|
───────────────────────────────────────────────────────────────────────── */
|
|
@@ -2677,6 +3302,11 @@ class EnhancedSelect extends HTMLElement {
|
|
|
2677
3302
|
display: none;
|
|
2678
3303
|
}
|
|
2679
3304
|
|
|
3305
|
+
:host([dir="rtl"]) .clear-control-button {
|
|
3306
|
+
right: auto;
|
|
3307
|
+
left: var(--select-clear-button-right, 8px);
|
|
3308
|
+
}
|
|
3309
|
+
|
|
2680
3310
|
.clear-control-icon {
|
|
2681
3311
|
width: var(--select-clear-icon-size);
|
|
2682
3312
|
height: var(--select-clear-icon-size);
|
|
@@ -2731,7 +3361,7 @@ class EnhancedSelect extends HTMLElement {
|
|
|
2731
3361
|
padding: var(--select-input-field-padding, 0) !important;
|
|
2732
3362
|
margin: 0 !important;
|
|
2733
3363
|
border: 0 !important;
|
|
2734
|
-
font-size: var(--select-input-font-size,
|
|
3364
|
+
font-size: var(--select-input-font-size, inherit);
|
|
2735
3365
|
line-height: var(--select-input-line-height, 1.5);
|
|
2736
3366
|
color: var(--select-input-color, var(--select-text));
|
|
2737
3367
|
background: transparent !important;
|
|
@@ -2739,13 +3369,16 @@ class EnhancedSelect extends HTMLElement {
|
|
|
2739
3369
|
outline: none !important;
|
|
2740
3370
|
font-weight: var(--select-input-font-weight);
|
|
2741
3371
|
letter-spacing: var(--select-input-letter-spacing);
|
|
2742
|
-
|
|
3372
|
+
font-family: var(--select-input-font-family, inherit);
|
|
3373
|
+
font-style: var(--select-input-font-style, normal);
|
|
3374
|
+
align-self: var(--select-input-align-self, center);
|
|
2743
3375
|
appearance: none !important;
|
|
2744
3376
|
-webkit-appearance: none !important;
|
|
2745
3377
|
box-shadow: none !important;
|
|
2746
3378
|
border-radius: 0 !important;
|
|
2747
3379
|
overflow: hidden;
|
|
2748
3380
|
text-overflow: ellipsis;
|
|
3381
|
+
text-align: var(--select-input-text-align, inherit);
|
|
2749
3382
|
white-space: nowrap;
|
|
2750
3383
|
}
|
|
2751
3384
|
|
|
@@ -2754,6 +3387,14 @@ class EnhancedSelect extends HTMLElement {
|
|
|
2754
3387
|
font-weight: 400;
|
|
2755
3388
|
}
|
|
2756
3389
|
|
|
3390
|
+
:host([dir="rtl"]) .input-container {
|
|
3391
|
+
padding: var(--select-input-padding-rtl, 10px 14px 10px 52px);
|
|
3392
|
+
}
|
|
3393
|
+
|
|
3394
|
+
:host([dir="rtl"]) .input-container.has-clear-control {
|
|
3395
|
+
padding: var(--select-input-padding-with-clear-rtl, 10px 14px 10px 84px);
|
|
3396
|
+
}
|
|
3397
|
+
|
|
2757
3398
|
.input-container.input-container--multi > .select-input,
|
|
2758
3399
|
.input-container.input-container--multi > input.select-input,
|
|
2759
3400
|
.input-container.input-container--multi > .select-input[type="text"] {
|
|
@@ -2784,10 +3425,12 @@ class EnhancedSelect extends HTMLElement {
|
|
|
2784
3425
|
position: absolute;
|
|
2785
3426
|
scroll-behavior: var(--select-dropdown-scroll-behavior);
|
|
2786
3427
|
top: var(--select-dropdown-top);
|
|
3428
|
+
bottom: auto;
|
|
2787
3429
|
left: 0;
|
|
2788
3430
|
right: 0;
|
|
2789
3431
|
max-height: var(--select-dropdown-max-height, 320px);
|
|
2790
3432
|
overflow: hidden;
|
|
3433
|
+
box-sizing: border-box;
|
|
2791
3434
|
background: var(--select-dropdown-bg, var(--select-surface));
|
|
2792
3435
|
border: 1px solid var(--select-dropdown-border, var(--select-border));
|
|
2793
3436
|
border-radius: var(--select-dropdown-border-radius, var(--select-radius-lg));
|
|
@@ -2796,6 +3439,16 @@ class EnhancedSelect extends HTMLElement {
|
|
|
2796
3439
|
transform-origin: var(--select-dropdown-transform-origin);
|
|
2797
3440
|
animation: var(--select-dropdown-animation);
|
|
2798
3441
|
}
|
|
3442
|
+
|
|
3443
|
+
.select-dropdown[data-placement="top"] {
|
|
3444
|
+
top: auto;
|
|
3445
|
+
bottom: var(--select-dropdown-bottom, calc(100% + 6px));
|
|
3446
|
+
transform-origin: var(--select-dropdown-top-transform-origin, bottom center);
|
|
3447
|
+
}
|
|
3448
|
+
|
|
3449
|
+
.select-dropdown[data-placement="top"] {
|
|
3450
|
+
--select-dropdown-enter-from-transform: var(--select-dropdown-top-enter-from-transform, translateY(8px) scale(0.98));
|
|
3451
|
+
}
|
|
2799
3452
|
|
|
2800
3453
|
@keyframes dropdownEnter {
|
|
2801
3454
|
0% {
|
|
@@ -2812,8 +3465,9 @@ class EnhancedSelect extends HTMLElement {
|
|
|
2812
3465
|
position: relative;
|
|
2813
3466
|
max-height: var(--select-options-max-height, 320px);
|
|
2814
3467
|
overflow: auto;
|
|
2815
|
-
|
|
2816
|
-
|
|
3468
|
+
box-sizing: border-box;
|
|
3469
|
+
padding: var(--select-options-padding, var(--select-dropdown-padding, 6px));
|
|
3470
|
+
background: var(--select-options-bg, var(--select-dropdown-bg, var(--select-surface)));
|
|
2817
3471
|
|
|
2818
3472
|
/* Custom scrollbar styling */
|
|
2819
3473
|
scrollbar-width: thin;
|
|
@@ -2842,18 +3496,26 @@ class EnhancedSelect extends HTMLElement {
|
|
|
2842
3496
|
───────────────────────────────────────────────────────────────────────── */
|
|
2843
3497
|
|
|
2844
3498
|
.group-header {
|
|
2845
|
-
padding: var(--select-group-header-padding, 10px 12px
|
|
3499
|
+
padding: var(--select-group-header-padding, 10px 12px 8px 12px);
|
|
3500
|
+
margin: var(--select-group-header-margin, 0 calc(var(--select-options-padding, 6px) * -1));
|
|
2846
3501
|
font-weight: var(--select-group-header-weight, 600);
|
|
2847
3502
|
color: var(--select-group-header-color, var(--select-text-muted));
|
|
2848
|
-
background
|
|
3503
|
+
background: var(--select-group-header-bg, #ffffff);
|
|
2849
3504
|
text-align: var(--select-group-header-text-align, left);
|
|
2850
|
-
font-size: var(--select-group-header-font-size,
|
|
3505
|
+
font-size: var(--select-group-header-font-size, 0.7333em);
|
|
2851
3506
|
text-transform: var(--select-group-header-text-transform, uppercase);
|
|
2852
3507
|
letter-spacing: var(--select-group-header-letter-spacing, 0.08em);
|
|
2853
3508
|
position: sticky;
|
|
2854
|
-
top:
|
|
2855
|
-
|
|
2856
|
-
|
|
3509
|
+
top: calc(var(--select-options-padding, 6px) * -1);
|
|
3510
|
+
left: 0;
|
|
3511
|
+
right: 0;
|
|
3512
|
+
z-index: 100;
|
|
3513
|
+
border: var(--select-group-header-border, none);
|
|
3514
|
+
border-bottom: var(--select-group-header-border-bottom, 1px solid rgba(0, 0, 0, 0.08));
|
|
3515
|
+
border-radius: var(--select-group-header-border-radius, 0);
|
|
3516
|
+
box-shadow: var(--select-group-header-shadow, 0 1px 2px rgba(0, 0, 0, 0.04));
|
|
3517
|
+
/* Force solid background to prevent option bleed-through */
|
|
3518
|
+
isolation: isolate;
|
|
2857
3519
|
}
|
|
2858
3520
|
|
|
2859
3521
|
.group-header:not(:first-child) {
|
|
@@ -2872,13 +3534,16 @@ class EnhancedSelect extends HTMLElement {
|
|
|
2872
3534
|
cursor: pointer;
|
|
2873
3535
|
color: var(--select-option-color, var(--select-text));
|
|
2874
3536
|
background: var(--select-option-bg, transparent);
|
|
3537
|
+
border: var(--select-option-border, none);
|
|
3538
|
+
text-align: var(--select-option-text-align, start);
|
|
2875
3539
|
transition:
|
|
2876
3540
|
background var(--select-transition-fast),
|
|
2877
3541
|
color var(--select-transition-fast),
|
|
3542
|
+
border-color var(--select-transition-fast),
|
|
2878
3543
|
transform var(--select-transition-fast),
|
|
2879
3544
|
box-shadow var(--select-transition-fast);
|
|
2880
3545
|
user-select: none;
|
|
2881
|
-
font-size: var(--select-option-font-size,
|
|
3546
|
+
font-size: var(--select-option-font-size, inherit);
|
|
2882
3547
|
font-weight: var(--select-option-font-weight);
|
|
2883
3548
|
line-height: var(--select-option-line-height, 1.5);
|
|
2884
3549
|
border-radius: var(--select-option-border-radius, var(--select-radius-sm));
|
|
@@ -2886,13 +3551,15 @@ class EnhancedSelect extends HTMLElement {
|
|
|
2886
3551
|
}
|
|
2887
3552
|
|
|
2888
3553
|
.option:hover {
|
|
2889
|
-
background: var(--select-option-hover-bg, var(--select-surface-elevated));
|
|
2890
|
-
|
|
2891
|
-
|
|
3554
|
+
background: calc(var(--select-option-hover-enabled, 1) * 1) > 0 ? var(--select-option-hover-bg, var(--select-surface-elevated)) : var(--select-option-bg, transparent);
|
|
3555
|
+
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);
|
|
3556
|
+
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));
|
|
3557
|
+
transform: calc(var(--select-option-hover-enabled, 1) * 1) > 0 ? var(--select-option-hover-transform) : none;
|
|
2892
3558
|
}
|
|
2893
3559
|
|
|
2894
3560
|
.option.selected {
|
|
2895
3561
|
background: var(--select-option-selected-bg, linear-gradient(135deg, rgba(15, 52, 96, 0.08) 0%, rgba(15, 52, 96, 0.04) 100%));
|
|
3562
|
+
border: var(--select-option-selected-border, var(--select-option-border, none));
|
|
2896
3563
|
color: var(--select-option-selected-color, var(--select-accent));
|
|
2897
3564
|
font-weight: var(--select-option-selected-weight, 550);
|
|
2898
3565
|
}
|
|
@@ -2909,6 +3576,12 @@ class EnhancedSelect extends HTMLElement {
|
|
|
2909
3576
|
border-radius: var(--select-option-selected-indicator-radius);
|
|
2910
3577
|
animation: var(--select-option-selected-indicator-animation);
|
|
2911
3578
|
}
|
|
3579
|
+
|
|
3580
|
+
:host([dir="rtl"]) .option.selected::before {
|
|
3581
|
+
left: auto;
|
|
3582
|
+
right: var(--select-option-selected-indicator-right, var(--select-option-selected-indicator-left));
|
|
3583
|
+
border-radius: var(--select-option-selected-indicator-radius-rtl, 2px 0 0 2px);
|
|
3584
|
+
}
|
|
2912
3585
|
|
|
2913
3586
|
@keyframes selectedIndicator {
|
|
2914
3587
|
0% {
|
|
@@ -2922,13 +3595,19 @@ class EnhancedSelect extends HTMLElement {
|
|
|
2922
3595
|
}
|
|
2923
3596
|
|
|
2924
3597
|
.option.selected:hover {
|
|
2925
|
-
background: var(--select-option-selected-hover-bg, linear-gradient(135deg, rgba(15, 52, 96, 0.12) 0%, rgba(15, 52, 96, 0.06) 100%));
|
|
3598
|
+
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%)));
|
|
3599
|
+
border: var(--select-option-selected-hover-border, var(--select-option-selected-border, var(--select-option-hover-border, var(--select-option-border, none))));
|
|
3600
|
+
color: var(--select-option-selected-hover-color, var(--select-option-selected-color, var(--select-accent)));
|
|
2926
3601
|
}
|
|
2927
3602
|
|
|
2928
3603
|
.option.active:not(.selected) {
|
|
2929
3604
|
background: var(--select-option-active-bg, var(--select-surface-elevated));
|
|
3605
|
+
color: var(--select-option-active-color, var(--select-option-hover-color, var(--select-option-color, var(--select-text))));
|
|
3606
|
+
border: var(--select-option-active-border, var(--select-option-hover-border, var(--select-option-border, none)));
|
|
2930
3607
|
outline: var(--select-option-active-outline, 2px solid rgba(15, 52, 96, 0.3));
|
|
2931
3608
|
outline-offset: var(--select-option-active-outline-offset);
|
|
3609
|
+
box-shadow: var(--select-option-active-shadow, none);
|
|
3610
|
+
transform: var(--select-option-active-transform, none);
|
|
2932
3611
|
}
|
|
2933
3612
|
|
|
2934
3613
|
.option.selected.active {
|
|
@@ -2936,6 +3615,14 @@ class EnhancedSelect extends HTMLElement {
|
|
|
2936
3615
|
outline-offset: var(--select-option-selected-active-outline-offset);
|
|
2937
3616
|
}
|
|
2938
3617
|
|
|
3618
|
+
.option.disabled {
|
|
3619
|
+
background: var(--select-option-disabled-bg, var(--select-option-bg, transparent));
|
|
3620
|
+
color: var(--select-option-disabled-color, var(--select-text-muted));
|
|
3621
|
+
border: var(--select-option-disabled-border, var(--select-option-border, none));
|
|
3622
|
+
opacity: var(--select-option-disabled-opacity, 0.5);
|
|
3623
|
+
cursor: var(--select-option-disabled-cursor, not-allowed);
|
|
3624
|
+
}
|
|
3625
|
+
|
|
2939
3626
|
.option:active:not(.selected) {
|
|
2940
3627
|
background: var(--select-option-pressed-bg, rgba(15, 52, 96, 0.08));
|
|
2941
3628
|
transform: var(--select-option-pressed-transform);
|
|
@@ -2961,7 +3648,7 @@ class EnhancedSelect extends HTMLElement {
|
|
|
2961
3648
|
color: var(--select-button-color, var(--select-accent));
|
|
2962
3649
|
border-radius: var(--select-button-border-radius, var(--select-radius-md));
|
|
2963
3650
|
cursor: pointer;
|
|
2964
|
-
font-size: var(--select-button-font-size,
|
|
3651
|
+
font-size: var(--select-button-font-size, 0.8667em);
|
|
2965
3652
|
font-weight: var(--select-button-font-weight);
|
|
2966
3653
|
letter-spacing: var(--select-button-letter-spacing);
|
|
2967
3654
|
transition:
|
|
@@ -2993,7 +3680,7 @@ class EnhancedSelect extends HTMLElement {
|
|
|
2993
3680
|
text-align: center;
|
|
2994
3681
|
color: var(--select-busy-color, var(--select-text-muted));
|
|
2995
3682
|
background: var(--select-busy-bg, transparent);
|
|
2996
|
-
font-size: var(--select-busy-font-size,
|
|
3683
|
+
font-size: var(--select-busy-font-size, 0.8667em);
|
|
2997
3684
|
}
|
|
2998
3685
|
|
|
2999
3686
|
.spinner {
|
|
@@ -3014,7 +3701,7 @@ class EnhancedSelect extends HTMLElement {
|
|
|
3014
3701
|
padding: var(--select-empty-padding, 32px 24px);
|
|
3015
3702
|
text-align: center;
|
|
3016
3703
|
color: var(--select-empty-color, var(--select-text-muted));
|
|
3017
|
-
font-size: var(--select-empty-font-size,
|
|
3704
|
+
font-size: var(--select-empty-font-size, 0.9333em);
|
|
3018
3705
|
background: var(--select-empty-bg, transparent);
|
|
3019
3706
|
display: flex;
|
|
3020
3707
|
flex-direction: column;
|
|
@@ -3027,7 +3714,7 @@ class EnhancedSelect extends HTMLElement {
|
|
|
3027
3714
|
padding: var(--select-searching-padding, 32px 24px);
|
|
3028
3715
|
text-align: center;
|
|
3029
3716
|
color: var(--select-searching-color, var(--select-accent));
|
|
3030
|
-
font-size: var(--select-searching-font-size,
|
|
3717
|
+
font-size: var(--select-searching-font-size, 0.9333em);
|
|
3031
3718
|
background: var(--select-searching-bg, transparent);
|
|
3032
3719
|
display: flex;
|
|
3033
3720
|
flex-direction: column;
|
|
@@ -3117,24 +3804,44 @@ class EnhancedSelect extends HTMLElement {
|
|
|
3117
3804
|
--select-primary-light: #2a2a3e;
|
|
3118
3805
|
--select-accent: #6366f1;
|
|
3119
3806
|
--select-accent-hover: #f43f5e;
|
|
3120
|
-
--select-surface: #1a1a2e;
|
|
3807
|
+
--select-surface: var(--select-dark-bg, #1a1a2e);
|
|
3121
3808
|
--select-surface-elevated: #252540;
|
|
3122
|
-
--select-border: #3f3f5a;
|
|
3809
|
+
--select-border: var(--select-dark-border, #3f3f5a);
|
|
3123
3810
|
--select-border-focus: #6366f1;
|
|
3124
|
-
--select-text: #f5f5f5;
|
|
3811
|
+
--select-text: var(--select-dark-text, #f5f5f5);
|
|
3125
3812
|
--select-text-muted: #9ca3af;
|
|
3126
3813
|
--select-text-placeholder: #6b7280;
|
|
3127
3814
|
--select-shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.2);
|
|
3128
3815
|
--select-shadow-md: 0 4px 12px rgba(0, 0, 0, 0.3);
|
|
3129
3816
|
--select-shadow-lg: 0 8px 24px rgba(0, 0, 0, 0.4);
|
|
3130
3817
|
--select-shadow-focus: 0 0 0 3px rgba(99, 102, 241, 0.25);
|
|
3818
|
+
|
|
3819
|
+
--select-dropdown-bg: var(--select-dark-dropdown-bg, var(--select-surface));
|
|
3820
|
+
|
|
3821
|
+
--select-arrow-color: var(--select-dark-arrow-color, #9ca3af);
|
|
3822
|
+
--select-arrow-hover-color: var(--select-dark-arrow-hover-color, #f5f5f5);
|
|
3823
|
+
--select-arrow-bg: var(--select-dark-arrow-bg, transparent);
|
|
3824
|
+
--select-arrow-hover-bg: var(--select-dark-arrow-hover-bg, rgba(156, 163, 175, 0.15));
|
|
3825
|
+
|
|
3826
|
+
--select-separator-bg: var(--select-dark-separator-bg, var(--select-separator-dark-bg));
|
|
3827
|
+
--select-separator-width: var(--select-dark-separator-width, 1px);
|
|
3131
3828
|
|
|
3132
|
-
--select-
|
|
3133
|
-
--select-
|
|
3134
|
-
|
|
3135
|
-
--select-
|
|
3136
|
-
--select-
|
|
3137
|
-
|
|
3829
|
+
--select-badge-bg: var(--select-dark-badge-bg, rgba(99, 102, 241, 0.2));
|
|
3830
|
+
--select-badge-color: var(--select-dark-badge-color, #e0e7ff);
|
|
3831
|
+
|
|
3832
|
+
--select-group-header-bg: var(--select-group-header-dark-bg, #1a1a2e);
|
|
3833
|
+
--select-group-header-color: var(--select-group-header-dark-color, #9ca3af);
|
|
3834
|
+
|
|
3835
|
+
--select-empty-color: var(--select-dark-empty-color, #9ca3af);
|
|
3836
|
+
|
|
3837
|
+
--select-option-bg: var(--select-dark-option-bg, transparent);
|
|
3838
|
+
--select-option-color: var(--select-dark-option-color, var(--select-text));
|
|
3839
|
+
--select-option-hover-bg: var(--select-dark-option-hover-bg, var(--select-surface-elevated));
|
|
3840
|
+
--select-option-hover-color: var(--select-dark-option-hover-color, var(--select-text));
|
|
3841
|
+
--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%));
|
|
3842
|
+
--select-option-selected-color: var(--select-dark-option-selected-color, #a5b4fc);
|
|
3843
|
+
--select-option-selected-hover-bg: var(--select-dark-option-selected-hover-bg, var(--select-option-selected-bg));
|
|
3844
|
+
--select-option-selected-hover-color: var(--select-dark-option-selected-hover-color, var(--select-option-selected-color));
|
|
3138
3845
|
}
|
|
3139
3846
|
|
|
3140
3847
|
:host(.dark-mode) .input-container,
|
|
@@ -3177,7 +3884,7 @@ class EnhancedSelect extends HTMLElement {
|
|
|
3177
3884
|
:host-context([darkmode]) .select-dropdown,
|
|
3178
3885
|
:host-context([data-theme="dark"]) .select-dropdown,
|
|
3179
3886
|
:host-context([theme="dark"]) .select-dropdown {
|
|
3180
|
-
background: var(--select-surface);
|
|
3887
|
+
background: var(--select-dropdown-bg, var(--select-surface));
|
|
3181
3888
|
border-color: var(--select-border);
|
|
3182
3889
|
}
|
|
3183
3890
|
|
|
@@ -3192,7 +3899,7 @@ class EnhancedSelect extends HTMLElement {
|
|
|
3192
3899
|
:host-context([darkmode]) .options-container,
|
|
3193
3900
|
:host-context([data-theme="dark"]) .options-container,
|
|
3194
3901
|
:host-context([theme="dark"]) .options-container {
|
|
3195
|
-
background: var(--select-surface);
|
|
3902
|
+
background: var(--select-dropdown-bg, var(--select-surface));
|
|
3196
3903
|
scrollbar-color: var(--select-border) transparent;
|
|
3197
3904
|
}
|
|
3198
3905
|
|
|
@@ -3224,6 +3931,22 @@ class EnhancedSelect extends HTMLElement {
|
|
|
3224
3931
|
border-top-color: var(--select-border);
|
|
3225
3932
|
}
|
|
3226
3933
|
|
|
3934
|
+
:host(.dark-mode) .group-header,
|
|
3935
|
+
:host([dark-mode]) .group-header,
|
|
3936
|
+
:host([darkmode]) .group-header,
|
|
3937
|
+
:host([data-theme="dark"]) .group-header,
|
|
3938
|
+
:host([theme="dark"]) .group-header,
|
|
3939
|
+
:host-context(.dark-mode) .group-header,
|
|
3940
|
+
:host-context(.dark) .group-header,
|
|
3941
|
+
:host-context([dark-mode]) .group-header,
|
|
3942
|
+
:host-context([darkmode]) .group-header,
|
|
3943
|
+
:host-context([data-theme="dark"]) .group-header,
|
|
3944
|
+
:host-context([theme="dark"]) .group-header {
|
|
3945
|
+
background: var(--select-group-header-bg, #1a1a2e);
|
|
3946
|
+
border-bottom: var(--select-group-header-border-bottom, 1px solid rgba(255, 255, 255, 0.08));
|
|
3947
|
+
box-shadow: var(--select-group-header-shadow, 0 1px 2px rgba(0, 0, 0, 0.3));
|
|
3948
|
+
}
|
|
3949
|
+
|
|
3227
3950
|
:host(.dark-mode) .option.selected::before,
|
|
3228
3951
|
:host([dark-mode]) .option.selected::before,
|
|
3229
3952
|
:host([darkmode]) .option.selected::before,
|
|
@@ -3289,6 +4012,19 @@ class EnhancedSelect extends HTMLElement {
|
|
|
3289
4012
|
return;
|
|
3290
4013
|
if (target && target.closest('.clear-control-button'))
|
|
3291
4014
|
return;
|
|
4015
|
+
if (this._isPointerOnInputScrollbar(e)) {
|
|
4016
|
+
this._suppressNextOpenClick = true;
|
|
4017
|
+
return;
|
|
4018
|
+
}
|
|
4019
|
+
const isHorizontalMultiMode = this._config.selection.mode === 'multi'
|
|
4020
|
+
&& (this._config.multiSelectDisplay?.mode ?? 'wrap') === 'horizontal';
|
|
4021
|
+
const enableHorizontalDrag = this._canUseHorizontalMultiScroll(target);
|
|
4022
|
+
if (enableHorizontalDrag && e.button === 0) {
|
|
4023
|
+
this._beginMultiScrollDrag(e);
|
|
4024
|
+
this._suppressNextOpenClick = false;
|
|
4025
|
+
e.preventDefault();
|
|
4026
|
+
return;
|
|
4027
|
+
}
|
|
3292
4028
|
// If we clicked the container, but not the input itself, we must prevent default
|
|
3293
4029
|
// otherwise the browser moves focus from our input to the body, immediately triggering blur.
|
|
3294
4030
|
if (target && !target.matches('.select-input')) {
|
|
@@ -3297,6 +4033,8 @@ class EnhancedSelect extends HTMLElement {
|
|
|
3297
4033
|
const clickedInput = Boolean(target && target.matches('.select-input'));
|
|
3298
4034
|
if (this._state.isOpen &&
|
|
3299
4035
|
this._config.selection.toggleOnTriggerClick !== false &&
|
|
4036
|
+
!isHorizontalMultiMode &&
|
|
4037
|
+
!enableHorizontalDrag &&
|
|
3300
4038
|
!(clickedInput && this._config.searchable)) {
|
|
3301
4039
|
this._handleClose();
|
|
3302
4040
|
return;
|
|
@@ -3319,6 +4057,47 @@ class EnhancedSelect extends HTMLElement {
|
|
|
3319
4057
|
}
|
|
3320
4058
|
}
|
|
3321
4059
|
});
|
|
4060
|
+
this._inputContainer.addEventListener('click', (e) => {
|
|
4061
|
+
const target = e.target;
|
|
4062
|
+
const isHorizontalMultiMode = this._config.selection.mode === 'multi'
|
|
4063
|
+
&& (this._config.multiSelectDisplay?.mode ?? 'wrap') === 'horizontal';
|
|
4064
|
+
if (!this._config.enabled || !isHorizontalMultiMode) {
|
|
4065
|
+
this._suppressNextOpenClick = false;
|
|
4066
|
+
this._multiScrollDrag.moved = false;
|
|
4067
|
+
return;
|
|
4068
|
+
}
|
|
4069
|
+
if (target && target.closest('.dropdown-arrow-container, .clear-control-button')) {
|
|
4070
|
+
this._suppressNextOpenClick = false;
|
|
4071
|
+
this._multiScrollDrag.moved = false;
|
|
4072
|
+
return;
|
|
4073
|
+
}
|
|
4074
|
+
if (this._suppressNextOpenClick || this._multiScrollDrag.moved || this._isPointerOnInputScrollbar(e)) {
|
|
4075
|
+
this._suppressNextOpenClick = false;
|
|
4076
|
+
this._multiScrollDrag.moved = false;
|
|
4077
|
+
return;
|
|
4078
|
+
}
|
|
4079
|
+
this._suppressNextOpenClick = false;
|
|
4080
|
+
this._multiScrollDrag.moved = false;
|
|
4081
|
+
if (!this._state.isOpen) {
|
|
4082
|
+
this._handleOpen();
|
|
4083
|
+
}
|
|
4084
|
+
this._input.focus();
|
|
4085
|
+
});
|
|
4086
|
+
this._inputContent.addEventListener('pointermove', (e) => {
|
|
4087
|
+
this._updateMultiScrollDrag(e);
|
|
4088
|
+
});
|
|
4089
|
+
this._inputContent.addEventListener('pointerup', (e) => {
|
|
4090
|
+
this._endMultiScrollDrag(e.pointerId);
|
|
4091
|
+
});
|
|
4092
|
+
this._inputContent.addEventListener('pointercancel', (e) => {
|
|
4093
|
+
this._endMultiScrollDrag(e.pointerId);
|
|
4094
|
+
});
|
|
4095
|
+
this._inputContent.addEventListener('wheel', (e) => {
|
|
4096
|
+
if (this._config.selection.mode === 'multi'
|
|
4097
|
+
&& (this._config.multiSelectDisplay?.mode ?? 'wrap') === 'horizontal') {
|
|
4098
|
+
e.preventDefault();
|
|
4099
|
+
}
|
|
4100
|
+
}, { passive: false });
|
|
3322
4101
|
// Input container click - prevent event from reaching document listener
|
|
3323
4102
|
this._container.addEventListener('click', (e) => {
|
|
3324
4103
|
e.stopPropagation();
|
|
@@ -3489,11 +4268,14 @@ class EnhancedSelect extends HTMLElement {
|
|
|
3489
4268
|
this._input.focus();
|
|
3490
4269
|
this._markOpenStart();
|
|
3491
4270
|
this._state.isOpen = true;
|
|
4271
|
+
this.setAttribute('data-open', 'true');
|
|
4272
|
+
this._liftStackingAncestors();
|
|
3492
4273
|
this._dropdown.style.display = 'block';
|
|
3493
4274
|
this._input.setAttribute('aria-expanded', 'true');
|
|
3494
4275
|
this._updateArrowRotation();
|
|
3495
4276
|
// Render options when opening
|
|
3496
4277
|
this._renderOptions();
|
|
4278
|
+
this._syncDropdownPlacement();
|
|
3497
4279
|
this._setInitialActiveOption();
|
|
3498
4280
|
this._emit('open', {});
|
|
3499
4281
|
this._config.callbacks.onOpen?.();
|
|
@@ -3513,7 +4295,10 @@ class EnhancedSelect extends HTMLElement {
|
|
|
3513
4295
|
if (!this._state.isOpen)
|
|
3514
4296
|
return;
|
|
3515
4297
|
this._state.isOpen = false;
|
|
4298
|
+
this.removeAttribute('data-open');
|
|
4299
|
+
this._restoreLiftedAncestors();
|
|
3516
4300
|
this._dropdown.style.display = 'none';
|
|
4301
|
+
this._dropdown.setAttribute('data-placement', this._resolvedDropdownPlacement);
|
|
3517
4302
|
this._input.setAttribute('aria-expanded', 'false');
|
|
3518
4303
|
this._input.removeAttribute('aria-activedescendant');
|
|
3519
4304
|
this._updateArrowRotation();
|
|
@@ -3523,14 +4308,76 @@ class EnhancedSelect extends HTMLElement {
|
|
|
3523
4308
|
}
|
|
3524
4309
|
_updateDropdownVisibility() {
|
|
3525
4310
|
if (this._state.isOpen) {
|
|
4311
|
+
this.setAttribute('data-open', 'true');
|
|
4312
|
+
this._liftStackingAncestors();
|
|
3526
4313
|
this._dropdown.style.display = 'block';
|
|
4314
|
+
this._syncDropdownPlacement();
|
|
3527
4315
|
this._input.setAttribute('aria-expanded', 'true');
|
|
3528
4316
|
}
|
|
3529
4317
|
else {
|
|
4318
|
+
this.removeAttribute('data-open');
|
|
4319
|
+
this._restoreLiftedAncestors();
|
|
3530
4320
|
this._dropdown.style.display = 'none';
|
|
3531
4321
|
this._input.setAttribute('aria-expanded', 'false');
|
|
3532
4322
|
}
|
|
3533
4323
|
}
|
|
4324
|
+
_liftStackingAncestors() {
|
|
4325
|
+
this._restoreLiftedAncestors();
|
|
4326
|
+
let ancestor = this.parentElement;
|
|
4327
|
+
while (ancestor && ancestor !== document.body) {
|
|
4328
|
+
if (this._createsStackingContext(ancestor)) {
|
|
4329
|
+
const hadMarker = ancestor.hasAttribute('data-smilodon-open-ancestor');
|
|
4330
|
+
this._liftedAncestors.push({
|
|
4331
|
+
element: ancestor,
|
|
4332
|
+
position: ancestor.style.position,
|
|
4333
|
+
zIndex: ancestor.style.zIndex,
|
|
4334
|
+
hadMarker,
|
|
4335
|
+
});
|
|
4336
|
+
if (getComputedStyle(ancestor).position === 'static') {
|
|
4337
|
+
ancestor.style.position = 'relative';
|
|
4338
|
+
}
|
|
4339
|
+
ancestor.style.zIndex = 'var(--select-ancestor-open-z-index, var(--select-host-open-z-index, var(--select-dropdown-z-index, 1000)))';
|
|
4340
|
+
ancestor.setAttribute('data-smilodon-open-ancestor', 'true');
|
|
4341
|
+
}
|
|
4342
|
+
ancestor = ancestor.parentElement;
|
|
4343
|
+
}
|
|
4344
|
+
}
|
|
4345
|
+
_restoreLiftedAncestors() {
|
|
4346
|
+
for (const lifted of this._liftedAncestors) {
|
|
4347
|
+
lifted.element.style.position = lifted.position;
|
|
4348
|
+
lifted.element.style.zIndex = lifted.zIndex;
|
|
4349
|
+
if (!lifted.hadMarker) {
|
|
4350
|
+
lifted.element.removeAttribute('data-smilodon-open-ancestor');
|
|
4351
|
+
}
|
|
4352
|
+
}
|
|
4353
|
+
this._liftedAncestors = [];
|
|
4354
|
+
}
|
|
4355
|
+
_createsStackingContext(element) {
|
|
4356
|
+
const style = getComputedStyle(element);
|
|
4357
|
+
if (style.position === 'fixed' || style.position === 'sticky')
|
|
4358
|
+
return true;
|
|
4359
|
+
if (style.zIndex !== 'auto' && style.position !== 'static')
|
|
4360
|
+
return true;
|
|
4361
|
+
if (style.opacity !== '1')
|
|
4362
|
+
return true;
|
|
4363
|
+
if (style.transform !== 'none')
|
|
4364
|
+
return true;
|
|
4365
|
+
if (style.filter !== 'none')
|
|
4366
|
+
return true;
|
|
4367
|
+
if (style.backdropFilter && style.backdropFilter !== 'none')
|
|
4368
|
+
return true;
|
|
4369
|
+
if (style.perspective !== 'none')
|
|
4370
|
+
return true;
|
|
4371
|
+
if (style.mixBlendMode !== 'normal')
|
|
4372
|
+
return true;
|
|
4373
|
+
if (style.isolation === 'isolate')
|
|
4374
|
+
return true;
|
|
4375
|
+
if (style.contain.includes('paint') || style.contain.includes('layout'))
|
|
4376
|
+
return true;
|
|
4377
|
+
if (style.willChange.includes('transform') || style.willChange.includes('opacity') || style.willChange.includes('filter'))
|
|
4378
|
+
return true;
|
|
4379
|
+
return false;
|
|
4380
|
+
}
|
|
3534
4381
|
_updateArrowRotation() {
|
|
3535
4382
|
if (this._arrowContainer) {
|
|
3536
4383
|
const arrow = this._arrowContainer.querySelector('.dropdown-arrow');
|
|
@@ -3694,8 +4541,12 @@ class EnhancedSelect extends HTMLElement {
|
|
|
3694
4541
|
}
|
|
3695
4542
|
break;
|
|
3696
4543
|
case 'Enter':
|
|
4544
|
+
case ' ':
|
|
3697
4545
|
e.preventDefault();
|
|
3698
|
-
if (this._state.
|
|
4546
|
+
if (!this._state.isOpen) {
|
|
4547
|
+
this._handleOpen();
|
|
4548
|
+
}
|
|
4549
|
+
else if (this._state.activeIndex >= 0) {
|
|
3699
4550
|
this._selectOption(this._state.activeIndex, { shiftKey: e.shiftKey, toggleKey: e.ctrlKey || e.metaKey });
|
|
3700
4551
|
}
|
|
3701
4552
|
break;
|
|
@@ -4002,7 +4853,7 @@ class EnhancedSelect extends HTMLElement {
|
|
|
4002
4853
|
this._input.value = '';
|
|
4003
4854
|
this._input.placeholder = this._config.placeholder || 'Select an option...';
|
|
4004
4855
|
// Clear any badges
|
|
4005
|
-
const existingBadges = this.
|
|
4856
|
+
const existingBadges = this._inputContent.querySelectorAll('.selection-badge');
|
|
4006
4857
|
existingBadges.forEach(badge => badge.remove());
|
|
4007
4858
|
}
|
|
4008
4859
|
else if (this._config.selection.mode === 'single') {
|
|
@@ -4013,16 +4864,23 @@ class EnhancedSelect extends HTMLElement {
|
|
|
4013
4864
|
this._input.value = '';
|
|
4014
4865
|
this._input.placeholder = '';
|
|
4015
4866
|
// Clear existing badges
|
|
4016
|
-
const existingBadges = this.
|
|
4867
|
+
const existingBadges = this._inputContent.querySelectorAll('.selection-badge');
|
|
4017
4868
|
existingBadges.forEach(badge => badge.remove());
|
|
4018
4869
|
// Create badges for each selected item
|
|
4019
4870
|
const selectedEntries = Array.from(this._state.selectedItems.entries());
|
|
4020
4871
|
selectedEntries.forEach(([index, item]) => {
|
|
4021
4872
|
const badge = document.createElement('span');
|
|
4022
4873
|
badge.className = 'selection-badge';
|
|
4874
|
+
if (this._config.styles.classNames?.badge) {
|
|
4875
|
+
badge.classList.add(...this._config.styles.classNames.badge.split(' ').filter(Boolean));
|
|
4876
|
+
}
|
|
4023
4877
|
badge.setAttribute('part', 'chip');
|
|
4024
4878
|
const badgeLabel = document.createElement('span');
|
|
4025
4879
|
badgeLabel.className = 'selection-badge-label';
|
|
4880
|
+
if (this._config.styles.classNames?.badgeLabel) {
|
|
4881
|
+
badgeLabel.classList.add(...this._config.styles.classNames.badgeLabel.split(' ').filter(Boolean));
|
|
4882
|
+
}
|
|
4883
|
+
badgeLabel.setAttribute('part', 'chip-label');
|
|
4026
4884
|
badgeLabel.textContent = getLabel(item);
|
|
4027
4885
|
badge.appendChild(badgeLabel);
|
|
4028
4886
|
// Add remove button to badge
|
|
@@ -4030,9 +4888,19 @@ class EnhancedSelect extends HTMLElement {
|
|
|
4030
4888
|
const removeBtn = document.createElement('button');
|
|
4031
4889
|
removeBtn.type = 'button';
|
|
4032
4890
|
removeBtn.className = 'badge-remove';
|
|
4891
|
+
if (this._config.styles.classNames?.removeButton) {
|
|
4892
|
+
removeBtn.classList.add(...this._config.styles.classNames.removeButton.split(' ').filter(Boolean));
|
|
4893
|
+
}
|
|
4894
|
+
if (this._config.styles.classNames?.badgeRemove) {
|
|
4895
|
+
removeBtn.classList.add(...this._config.styles.classNames.badgeRemove.split(' ').filter(Boolean));
|
|
4896
|
+
}
|
|
4033
4897
|
removeBtn.setAttribute('part', 'chip-remove');
|
|
4034
|
-
removeBtn.innerHTML = '×';
|
|
4035
4898
|
removeBtn.setAttribute('aria-label', `Remove ${getLabel(item)}`);
|
|
4899
|
+
const removeIcon = document.createElement('span');
|
|
4900
|
+
removeIcon.className = 'badge-remove-icon';
|
|
4901
|
+
removeIcon.setAttribute('part', 'chip-remove-icon');
|
|
4902
|
+
this._setIconContent(removeIcon, this._config.selection.removeButtonIcon, '×');
|
|
4903
|
+
removeBtn.appendChild(removeIcon);
|
|
4036
4904
|
removeBtn.addEventListener('pointerdown', (e) => {
|
|
4037
4905
|
e.stopPropagation();
|
|
4038
4906
|
e.preventDefault();
|
|
@@ -4044,7 +4912,7 @@ class EnhancedSelect extends HTMLElement {
|
|
|
4044
4912
|
});
|
|
4045
4913
|
badge.appendChild(removeBtn);
|
|
4046
4914
|
}
|
|
4047
|
-
this.
|
|
4915
|
+
this._inputContent.insertBefore(badge, this._input);
|
|
4048
4916
|
});
|
|
4049
4917
|
}
|
|
4050
4918
|
this._syncClearControlState();
|
|
@@ -4517,6 +5385,7 @@ class EnhancedSelect extends HTMLElement {
|
|
|
4517
5385
|
if (this._clearControlIcon) {
|
|
4518
5386
|
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>`;
|
|
4519
5387
|
}
|
|
5388
|
+
this._syncStyleConfigVariables();
|
|
4520
5389
|
if (this._dropdown) {
|
|
4521
5390
|
if (this._config.selection.mode === 'multi') {
|
|
4522
5391
|
this._dropdown.setAttribute('aria-multiselectable', 'true');
|
|
@@ -4525,10 +5394,14 @@ class EnhancedSelect extends HTMLElement {
|
|
|
4525
5394
|
this._dropdown.removeAttribute('aria-multiselectable');
|
|
4526
5395
|
}
|
|
4527
5396
|
}
|
|
5397
|
+
this._syncDirectionConfig();
|
|
4528
5398
|
this._syncInputContainerMode();
|
|
5399
|
+
this._syncMultiSelectDisplayConfig();
|
|
5400
|
+
this._syncDropdownPlacement();
|
|
4529
5401
|
// Re-initialize observers in case infinite scroll was enabled/disabled
|
|
4530
5402
|
this._initializeObservers();
|
|
4531
5403
|
this._syncClearControlState();
|
|
5404
|
+
this._updateInputDisplay();
|
|
4532
5405
|
this._renderOptions();
|
|
4533
5406
|
}
|
|
4534
5407
|
_mergeConfig(target, source) {
|
|
@@ -4684,6 +5557,9 @@ class EnhancedSelect extends HTMLElement {
|
|
|
4684
5557
|
header.textContent = group.label;
|
|
4685
5558
|
}
|
|
4686
5559
|
header.classList.add('group-header');
|
|
5560
|
+
if (this._config.styles.classNames?.groupHeader) {
|
|
5561
|
+
header.classList.add(...this._config.styles.classNames.groupHeader.split(' ').filter(Boolean));
|
|
5562
|
+
}
|
|
4687
5563
|
header.setAttribute('part', 'group-header');
|
|
4688
5564
|
this._optionsContainer.appendChild(header);
|
|
4689
5565
|
group.options.forEach(item => {
|
|
@@ -4811,6 +5687,7 @@ class EnhancedSelect extends HTMLElement {
|
|
|
4811
5687
|
disabled: isDisabled,
|
|
4812
5688
|
id: optionId,
|
|
4813
5689
|
});
|
|
5690
|
+
optionElement.setAttribute('dir', this._config.direction ?? 'ltr');
|
|
4814
5691
|
targetContainer.appendChild(optionElement);
|
|
4815
5692
|
return;
|
|
4816
5693
|
}
|
|
@@ -4824,8 +5701,23 @@ class EnhancedSelect extends HTMLElement {
|
|
|
4824
5701
|
getValue,
|
|
4825
5702
|
getLabel,
|
|
4826
5703
|
showRemoveButton: this._config.selection.mode === 'multi' && this._config.selection.showRemoveButton,
|
|
5704
|
+
removeButtonIcon: this._config.selection.removeButtonIcon,
|
|
4827
5705
|
classMap: this.classMap,
|
|
5706
|
+
className: this._config.styles.classNames?.option,
|
|
4828
5707
|
});
|
|
5708
|
+
if (this._config.styles.classNames?.option) {
|
|
5709
|
+
option.classList.add(...this._config.styles.classNames.option.split(' ').filter(Boolean));
|
|
5710
|
+
}
|
|
5711
|
+
option.setAttribute('dir', this._config.direction ?? 'ltr');
|
|
5712
|
+
if (isSelected && this._config.styles.classNames?.selectedOption) {
|
|
5713
|
+
option.classList.add(...this._config.styles.classNames.selectedOption.split(' ').filter(Boolean));
|
|
5714
|
+
}
|
|
5715
|
+
if (this._state.activeIndex === index && this._config.styles.classNames?.activeOption) {
|
|
5716
|
+
option.classList.add(...this._config.styles.classNames.activeOption.split(' ').filter(Boolean));
|
|
5717
|
+
}
|
|
5718
|
+
if (isDisabled && this._config.styles.classNames?.disabledOption) {
|
|
5719
|
+
option.classList.add(...this._config.styles.classNames.disabledOption.split(' ').filter(Boolean));
|
|
5720
|
+
}
|
|
4829
5721
|
// Valid part attribute on the web component host itself
|
|
4830
5722
|
option.setAttribute('part', 'option');
|
|
4831
5723
|
option.dataset.index = String(index);
|
|
@@ -4859,6 +5751,9 @@ class EnhancedSelect extends HTMLElement {
|
|
|
4859
5751
|
}
|
|
4860
5752
|
// Add both semantic namespaced classes and the legacy internal classes that CSS uses
|
|
4861
5753
|
optionEl.classList.add('smilodon-option', 'option');
|
|
5754
|
+
if (this._config.styles.classNames?.option) {
|
|
5755
|
+
optionEl.classList.add(...this._config.styles.classNames.option.split(' ').filter(Boolean));
|
|
5756
|
+
}
|
|
4862
5757
|
// Toggle state classes using classMap if available
|
|
4863
5758
|
const isSelected = meta.selected;
|
|
4864
5759
|
const isActive = meta.active;
|
|
@@ -4870,26 +5765,44 @@ class EnhancedSelect extends HTMLElement {
|
|
|
4870
5765
|
if (isSelected) {
|
|
4871
5766
|
optionEl.classList.add(...selectedClasses);
|
|
4872
5767
|
optionEl.classList.add('smilodon-option--selected');
|
|
5768
|
+
if (this._config.styles.classNames?.selectedOption) {
|
|
5769
|
+
optionEl.classList.add(...this._config.styles.classNames.selectedOption.split(' ').filter(Boolean));
|
|
5770
|
+
}
|
|
4873
5771
|
}
|
|
4874
5772
|
else {
|
|
4875
5773
|
optionEl.classList.remove(...selectedClasses);
|
|
4876
5774
|
optionEl.classList.remove('smilodon-option--selected');
|
|
5775
|
+
if (this._config.styles.classNames?.selectedOption) {
|
|
5776
|
+
optionEl.classList.remove(...this._config.styles.classNames.selectedOption.split(' ').filter(Boolean));
|
|
5777
|
+
}
|
|
4877
5778
|
}
|
|
4878
5779
|
if (isActive) {
|
|
4879
5780
|
optionEl.classList.add(...activeClasses);
|
|
4880
5781
|
optionEl.classList.add('smilodon-option--active');
|
|
5782
|
+
if (this._config.styles.classNames?.activeOption) {
|
|
5783
|
+
optionEl.classList.add(...this._config.styles.classNames.activeOption.split(' ').filter(Boolean));
|
|
5784
|
+
}
|
|
4881
5785
|
}
|
|
4882
5786
|
else {
|
|
4883
5787
|
optionEl.classList.remove(...activeClasses);
|
|
4884
5788
|
optionEl.classList.remove('smilodon-option--active');
|
|
5789
|
+
if (this._config.styles.classNames?.activeOption) {
|
|
5790
|
+
optionEl.classList.remove(...this._config.styles.classNames.activeOption.split(' ').filter(Boolean));
|
|
5791
|
+
}
|
|
4885
5792
|
}
|
|
4886
5793
|
if (isDisabled) {
|
|
4887
5794
|
optionEl.classList.add(...disabledClasses);
|
|
4888
5795
|
optionEl.classList.add('smilodon-option--disabled');
|
|
5796
|
+
if (this._config.styles.classNames?.disabledOption) {
|
|
5797
|
+
optionEl.classList.add(...this._config.styles.classNames.disabledOption.split(' ').filter(Boolean));
|
|
5798
|
+
}
|
|
4889
5799
|
}
|
|
4890
5800
|
else {
|
|
4891
5801
|
optionEl.classList.remove(...disabledClasses);
|
|
4892
5802
|
optionEl.classList.remove('smilodon-option--disabled');
|
|
5803
|
+
if (this._config.styles.classNames?.disabledOption) {
|
|
5804
|
+
optionEl.classList.remove(...this._config.styles.classNames.disabledOption.split(' ').filter(Boolean));
|
|
5805
|
+
}
|
|
4893
5806
|
}
|
|
4894
5807
|
// Data Attributes Contract
|
|
4895
5808
|
const state = [];
|