@smilodon/core 1.22.0 → 1.23.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +64 -2
- package/dist/index.cjs +326 -91
- package/dist/index.cjs.map +1 -1
- package/dist/index.js +326 -91
- 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 +326 -91
- 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 +6 -0
- package/dist/types/src/config/global-config.d.ts +7 -1
- package/dist/types/src/engine/contracts.d.ts +1 -1
- package/package.json +1 -1
package/dist/index.cjs
CHANGED
|
@@ -2206,6 +2206,7 @@ const defaultConfig = {
|
|
|
2206
2206
|
selectable: false,
|
|
2207
2207
|
hoverable: false,
|
|
2208
2208
|
focusable: false,
|
|
2209
|
+
closeOnClick: false,
|
|
2209
2210
|
},
|
|
2210
2211
|
maxSelections: 0,
|
|
2211
2212
|
showRemoveButton: true,
|
|
@@ -2252,6 +2253,7 @@ const defaultConfig = {
|
|
|
2252
2253
|
minDisplayTime: 200,
|
|
2253
2254
|
contentMode: 'append',
|
|
2254
2255
|
},
|
|
2256
|
+
searchingMessage: 'Searching...',
|
|
2255
2257
|
styles: {
|
|
2256
2258
|
classNames: {},
|
|
2257
2259
|
},
|
|
@@ -2740,6 +2742,7 @@ class SelectOption extends HTMLElement {
|
|
|
2740
2742
|
:host {
|
|
2741
2743
|
display: block;
|
|
2742
2744
|
position: relative;
|
|
2745
|
+
z-index: var(--select-option-z-index, auto);
|
|
2743
2746
|
font: inherit;
|
|
2744
2747
|
color: var(--select-option-color, var(--select-text-color, #1f2937));
|
|
2745
2748
|
background: var(--select-option-bg, var(--select-dropdown-bg, var(--select-bg, white)));
|
|
@@ -2802,7 +2805,7 @@ class SelectOption extends HTMLElement {
|
|
|
2802
2805
|
border-bottom: var(--select-option-disabled-border-bottom, var(--select-option-border-bottom, none));
|
|
2803
2806
|
opacity: var(--select-option-disabled-opacity, 0.5);
|
|
2804
2807
|
cursor: var(--select-option-disabled-cursor, not-allowed);
|
|
2805
|
-
pointer-events:
|
|
2808
|
+
pointer-events: auto;
|
|
2806
2809
|
}
|
|
2807
2810
|
|
|
2808
2811
|
:host(.smilodon-option--disabled-interactive) {
|
|
@@ -2872,7 +2875,7 @@ class SelectOption extends HTMLElement {
|
|
|
2872
2875
|
border-bottom: inherit;
|
|
2873
2876
|
opacity: inherit;
|
|
2874
2877
|
cursor: inherit;
|
|
2875
|
-
pointer-events:
|
|
2878
|
+
pointer-events: auto;
|
|
2876
2879
|
}
|
|
2877
2880
|
|
|
2878
2881
|
.option-content {
|
|
@@ -2973,6 +2976,7 @@ class SelectOption extends HTMLElement {
|
|
|
2973
2976
|
selectable: behavior.selectable === true,
|
|
2974
2977
|
hoverable: behavior.hoverable === true,
|
|
2975
2978
|
focusable: behavior.focusable === true,
|
|
2979
|
+
closeOnClick: behavior.closeOnClick === true,
|
|
2976
2980
|
};
|
|
2977
2981
|
}
|
|
2978
2982
|
_isDisabledSelectionBlocked() {
|
|
@@ -4350,6 +4354,12 @@ class DataRequestCoordinator {
|
|
|
4350
4354
|
*
|
|
4351
4355
|
* Redesigned with formal elegance, refined microinteractions, and polished UX
|
|
4352
4356
|
*/
|
|
4357
|
+
const DROPDOWN_BORDER_LONGHANDS = [
|
|
4358
|
+
'border-top-width', 'border-right-width', 'border-bottom-width', 'border-left-width',
|
|
4359
|
+
'border-top-style', 'border-right-style', 'border-bottom-style', 'border-left-style',
|
|
4360
|
+
'border-top-color', 'border-right-color', 'border-bottom-color', 'border-left-color',
|
|
4361
|
+
'border-image-source', 'border-image-slice', 'border-image-width', 'border-image-outset', 'border-image-repeat',
|
|
4362
|
+
];
|
|
4353
4363
|
const LEGACY_DATA_LOADING_CONFIG = {
|
|
4354
4364
|
protocol: 'legacy',
|
|
4355
4365
|
searchMode: 'local',
|
|
@@ -4468,6 +4478,8 @@ class EnhancedSelect extends HTMLElement {
|
|
|
4468
4478
|
this._selectedLabelTooltipResizeObserver = null;
|
|
4469
4479
|
this._selectedLabelTooltipMeasureFrame = null;
|
|
4470
4480
|
this._selectedLabelKeys = new WeakMap();
|
|
4481
|
+
this._dropdownConfigInlineStyles = new Map();
|
|
4482
|
+
this._managedLoaderClasses = new Set();
|
|
4471
4483
|
this._busyPresentationVisible = false;
|
|
4472
4484
|
this._busyPresentationStartedAt = null;
|
|
4473
4485
|
this._busyPresentationGeneration = 0;
|
|
@@ -4702,6 +4714,7 @@ class EnhancedSelect extends HTMLElement {
|
|
|
4702
4714
|
this._arrowContainer = this._createArrowContainer();
|
|
4703
4715
|
this._clearControl = this._createClearControl();
|
|
4704
4716
|
this._dropdown = this._createDropdown();
|
|
4717
|
+
this._syncDropdownConfigInlineStyles();
|
|
4705
4718
|
this._optionsContainer = this._createOptionsContainer();
|
|
4706
4719
|
this._liveRegion = this._createLiveRegion();
|
|
4707
4720
|
this._errorDescription = this._createErrorDescription();
|
|
@@ -5313,6 +5326,7 @@ class EnhancedSelect extends HTMLElement {
|
|
|
5313
5326
|
selectable: behavior.selectable === true,
|
|
5314
5327
|
hoverable: behavior.hoverable === true,
|
|
5315
5328
|
focusable: behavior.focusable === true,
|
|
5329
|
+
closeOnClick: behavior.closeOnClick === true,
|
|
5316
5330
|
};
|
|
5317
5331
|
}
|
|
5318
5332
|
_isDisabledOptionSelectable(item) {
|
|
@@ -5556,6 +5570,7 @@ class EnhancedSelect extends HTMLElement {
|
|
|
5556
5570
|
const styles = this._config.styles;
|
|
5557
5571
|
if (!styles)
|
|
5558
5572
|
return;
|
|
5573
|
+
this._syncLoaderClassNames();
|
|
5559
5574
|
this._applyStyleVariableMap(styles.option, {
|
|
5560
5575
|
background: '--select-option-bg',
|
|
5561
5576
|
backgroundColor: '--select-option-bg',
|
|
@@ -5571,6 +5586,7 @@ class EnhancedSelect extends HTMLElement {
|
|
|
5571
5586
|
fontWeight: '--select-option-font-weight',
|
|
5572
5587
|
lineHeight: '--select-option-line-height',
|
|
5573
5588
|
textAlign: '--select-option-text-align',
|
|
5589
|
+
zIndex: '--select-option-z-index',
|
|
5574
5590
|
});
|
|
5575
5591
|
this._applyStyleVariableMap(styles.selectedOption, {
|
|
5576
5592
|
background: '--select-option-selected-bg',
|
|
@@ -5724,8 +5740,35 @@ class EnhancedSelect extends HTMLElement {
|
|
|
5724
5740
|
fontWeight: '--select-group-header-weight',
|
|
5725
5741
|
textTransform: '--select-group-header-text-transform',
|
|
5726
5742
|
letterSpacing: '--select-group-header-letter-spacing',
|
|
5743
|
+
position: '--select-group-header-position',
|
|
5744
|
+
top: '--select-group-header-top',
|
|
5745
|
+
zIndex: '--select-group-header-z-index',
|
|
5746
|
+
});
|
|
5747
|
+
this._applyStyleVariableMap(styles.loader, {
|
|
5748
|
+
gap: '--select-loader-gap',
|
|
5749
|
+
padding: '--select-loader-padding',
|
|
5750
|
+
color: '--select-loader-color',
|
|
5751
|
+
background: '--select-loader-bg',
|
|
5752
|
+
backgroundColor: '--select-loader-bg',
|
|
5753
|
+
fontSize: '--select-loader-font-size',
|
|
5754
|
+
textAlign: '--select-loader-text-align',
|
|
5755
|
+
alignItems: '--select-loader-align-items',
|
|
5756
|
+
justifyContent: '--select-loader-justify-content',
|
|
5727
5757
|
});
|
|
5728
5758
|
}
|
|
5759
|
+
_syncLoaderClassNames(additionalTarget) {
|
|
5760
|
+
const classNames = new Set((this._config.styles.classNames?.loader ?? '').split(/\s+/).filter(Boolean));
|
|
5761
|
+
const targets = [
|
|
5762
|
+
this._busyBucket,
|
|
5763
|
+
this._optionsContainer?.querySelector('.searching-state'),
|
|
5764
|
+
additionalTarget,
|
|
5765
|
+
].filter((element) => Boolean(element));
|
|
5766
|
+
for (const target of targets) {
|
|
5767
|
+
target.classList.remove(...this._managedLoaderClasses);
|
|
5768
|
+
target.classList.add(...classNames);
|
|
5769
|
+
}
|
|
5770
|
+
this._managedLoaderClasses = classNames;
|
|
5771
|
+
}
|
|
5729
5772
|
_resolveDropdownPlacement() {
|
|
5730
5773
|
const placementMode = this._config.dropdownPlacement?.mode ?? 'bottom';
|
|
5731
5774
|
if (placementMode === 'bottom' || placementMode === 'top') {
|
|
@@ -6023,11 +6066,139 @@ class EnhancedSelect extends HTMLElement {
|
|
|
6023
6066
|
if (this._config.styles.classNames?.dropdown) {
|
|
6024
6067
|
dropdown.className += ' ' + this._config.styles.classNames.dropdown;
|
|
6025
6068
|
}
|
|
6026
|
-
if (this._config.styles.dropdown) {
|
|
6027
|
-
Object.assign(dropdown.style, this._config.styles.dropdown);
|
|
6028
|
-
}
|
|
6029
6069
|
return dropdown;
|
|
6030
6070
|
}
|
|
6071
|
+
_syncDropdownConfigInlineStyles() {
|
|
6072
|
+
if (!this._dropdown)
|
|
6073
|
+
return;
|
|
6074
|
+
const toCssProperty = (property) => {
|
|
6075
|
+
if (property.startsWith('--'))
|
|
6076
|
+
return property;
|
|
6077
|
+
if (property === 'cssFloat')
|
|
6078
|
+
return 'float';
|
|
6079
|
+
return property.replace(/[A-Z]/g, (character) => `-${character.toLowerCase()}`);
|
|
6080
|
+
};
|
|
6081
|
+
const configured = new Map();
|
|
6082
|
+
for (const [property, value] of Object.entries(this._config.styles.dropdown ?? {})) {
|
|
6083
|
+
if (value === undefined || value === null || String(value).trim() === '')
|
|
6084
|
+
continue;
|
|
6085
|
+
configured.set(toCssProperty(property), String(value));
|
|
6086
|
+
}
|
|
6087
|
+
const style = this._dropdown.style;
|
|
6088
|
+
const readValue = (property) => style.getPropertyValue(property).trim();
|
|
6089
|
+
const readSnapshot = (property) => ({
|
|
6090
|
+
value: readValue(property),
|
|
6091
|
+
priority: style.getPropertyPriority(property),
|
|
6092
|
+
});
|
|
6093
|
+
const sameSnapshot = (left, right) => left.value === right.value && left.priority === right.priority;
|
|
6094
|
+
const readBorderParts = () => new Map(DROPDOWN_BORDER_LONGHANDS.map((part) => [part, readSnapshot(part)]));
|
|
6095
|
+
const restoreValue = (property, value, priority) => {
|
|
6096
|
+
if (value)
|
|
6097
|
+
style.setProperty(property, value, priority);
|
|
6098
|
+
else
|
|
6099
|
+
style.removeProperty(property);
|
|
6100
|
+
};
|
|
6101
|
+
for (const [property, previousOwnership] of this._dropdownConfigInlineStyles) {
|
|
6102
|
+
const currentValue = readValue(property);
|
|
6103
|
+
const currentPriority = style.getPropertyPriority(property);
|
|
6104
|
+
const isStillCoreOwned = currentValue === previousOwnership.appliedValue
|
|
6105
|
+
&& currentPriority === previousOwnership.appliedPriority;
|
|
6106
|
+
const previousValue = isStillCoreOwned ? previousOwnership.previousValue : currentValue;
|
|
6107
|
+
const previousPriority = isStillCoreOwned ? previousOwnership.previousPriority : currentPriority;
|
|
6108
|
+
const nextValue = configured.get(property);
|
|
6109
|
+
const relatedBorderParts = previousOwnership.relatedBorderParts;
|
|
6110
|
+
if (nextValue === undefined) {
|
|
6111
|
+
const borderPartRestorations = relatedBorderParts
|
|
6112
|
+
? [...relatedBorderParts].map(([part, ownership]) => {
|
|
6113
|
+
const current = readSnapshot(part);
|
|
6114
|
+
return [part, sameSnapshot(current, ownership.applied) ? ownership.previous : current];
|
|
6115
|
+
})
|
|
6116
|
+
: [];
|
|
6117
|
+
if (isStillCoreOwned)
|
|
6118
|
+
restoreValue(property, previousValue, previousPriority);
|
|
6119
|
+
for (const [part, restore] of borderPartRestorations) {
|
|
6120
|
+
restoreValue(part, restore.value, restore.priority);
|
|
6121
|
+
}
|
|
6122
|
+
// A shorthand and a longhand can both own the same border components.
|
|
6123
|
+
// When one layer is released, rebase any still-active layer whose saved
|
|
6124
|
+
// baseline came from the released layer's applied value. Otherwise the
|
|
6125
|
+
// final release can resurrect an intermediate Core value instead of
|
|
6126
|
+
// the consumer-authored declaration.
|
|
6127
|
+
if (relatedBorderParts) {
|
|
6128
|
+
for (const [otherProperty, otherOwnership] of this._dropdownConfigInlineStyles) {
|
|
6129
|
+
if (otherProperty === property || !otherOwnership.relatedBorderParts)
|
|
6130
|
+
continue;
|
|
6131
|
+
for (const [part, released] of relatedBorderParts) {
|
|
6132
|
+
const other = otherOwnership.relatedBorderParts.get(part);
|
|
6133
|
+
if (!other)
|
|
6134
|
+
continue;
|
|
6135
|
+
const current = readSnapshot(part);
|
|
6136
|
+
if (sameSnapshot(current, other.applied) && sameSnapshot(other.previous, released.applied)) {
|
|
6137
|
+
otherOwnership.relatedBorderParts.set(part, {
|
|
6138
|
+
...other,
|
|
6139
|
+
previous: released.previous,
|
|
6140
|
+
});
|
|
6141
|
+
}
|
|
6142
|
+
}
|
|
6143
|
+
}
|
|
6144
|
+
}
|
|
6145
|
+
this._dropdownConfigInlineStyles.delete(property);
|
|
6146
|
+
continue;
|
|
6147
|
+
}
|
|
6148
|
+
const tracksBorderParts = property === 'border' || property === 'border-width';
|
|
6149
|
+
const beforeBorderParts = tracksBorderParts ? readBorderParts() : undefined;
|
|
6150
|
+
style.setProperty(property, nextValue);
|
|
6151
|
+
const afterBorderParts = tracksBorderParts ? readBorderParts() : undefined;
|
|
6152
|
+
let nextRelatedBorderParts;
|
|
6153
|
+
if (beforeBorderParts && afterBorderParts) {
|
|
6154
|
+
nextRelatedBorderParts = new Map();
|
|
6155
|
+
for (const part of DROPDOWN_BORDER_LONGHANDS) {
|
|
6156
|
+
const before = beforeBorderParts.get(part);
|
|
6157
|
+
const after = afterBorderParts.get(part);
|
|
6158
|
+
const previous = relatedBorderParts?.get(part);
|
|
6159
|
+
if (previous || !sameSnapshot(before, after)) {
|
|
6160
|
+
nextRelatedBorderParts.set(part, {
|
|
6161
|
+
previous: previous && sameSnapshot(before, previous.applied) ? previous.previous : before,
|
|
6162
|
+
applied: after,
|
|
6163
|
+
});
|
|
6164
|
+
}
|
|
6165
|
+
}
|
|
6166
|
+
}
|
|
6167
|
+
this._dropdownConfigInlineStyles.set(property, {
|
|
6168
|
+
appliedValue: readValue(property),
|
|
6169
|
+
appliedPriority: style.getPropertyPriority(property),
|
|
6170
|
+
previousValue,
|
|
6171
|
+
previousPriority,
|
|
6172
|
+
...(nextRelatedBorderParts ? { relatedBorderParts: nextRelatedBorderParts } : {}),
|
|
6173
|
+
});
|
|
6174
|
+
configured.delete(property);
|
|
6175
|
+
}
|
|
6176
|
+
for (const [property, value] of configured) {
|
|
6177
|
+
const previousValue = readValue(property);
|
|
6178
|
+
const previousPriority = style.getPropertyPriority(property);
|
|
6179
|
+
const tracksBorderParts = property === 'border' || property === 'border-width';
|
|
6180
|
+
const beforeBorderParts = tracksBorderParts ? readBorderParts() : undefined;
|
|
6181
|
+
style.setProperty(property, value);
|
|
6182
|
+
const afterBorderParts = tracksBorderParts ? readBorderParts() : undefined;
|
|
6183
|
+
let relatedBorderParts;
|
|
6184
|
+
if (beforeBorderParts && afterBorderParts) {
|
|
6185
|
+
relatedBorderParts = new Map();
|
|
6186
|
+
for (const part of DROPDOWN_BORDER_LONGHANDS) {
|
|
6187
|
+
const before = beforeBorderParts.get(part);
|
|
6188
|
+
const after = afterBorderParts.get(part);
|
|
6189
|
+
if (!sameSnapshot(before, after))
|
|
6190
|
+
relatedBorderParts.set(part, { previous: before, applied: after });
|
|
6191
|
+
}
|
|
6192
|
+
}
|
|
6193
|
+
this._dropdownConfigInlineStyles.set(property, {
|
|
6194
|
+
appliedValue: readValue(property),
|
|
6195
|
+
appliedPriority: style.getPropertyPriority(property),
|
|
6196
|
+
previousValue,
|
|
6197
|
+
previousPriority,
|
|
6198
|
+
...(relatedBorderParts ? { relatedBorderParts } : {}),
|
|
6199
|
+
});
|
|
6200
|
+
}
|
|
6201
|
+
}
|
|
6031
6202
|
_createOptionsContainer() {
|
|
6032
6203
|
const container = document.createElement('div');
|
|
6033
6204
|
container.className = `options-container ${EnhancedSelect._MIRRORED_STYLES_SCOPE_CLASS}`;
|
|
@@ -6295,7 +6466,6 @@ class EnhancedSelect extends HTMLElement {
|
|
|
6295
6466
|
--select-group-header-separator-border-top: none;
|
|
6296
6467
|
--select-reduced-motion-duration: 0.01ms;
|
|
6297
6468
|
--select-reduced-motion-iteration-count: 1;
|
|
6298
|
-
--select-high-contrast-border-width: 2px;
|
|
6299
6469
|
--select-high-contrast-indicator-width: 4px;
|
|
6300
6470
|
--select-high-contrast-focus-outline-width: 3px;
|
|
6301
6471
|
--select-high-contrast-focus-outline-color: Highlight;
|
|
@@ -6965,7 +7135,10 @@ class EnhancedSelect extends HTMLElement {
|
|
|
6965
7135
|
overflow: hidden;
|
|
6966
7136
|
box-sizing: border-box;
|
|
6967
7137
|
background: var(--select-dropdown-bg, var(--select-surface));
|
|
6968
|
-
border:
|
|
7138
|
+
border:
|
|
7139
|
+
var(--select-dropdown-border-width, 1px)
|
|
7140
|
+
var(--select-dropdown-border-style, solid)
|
|
7141
|
+
var(--select-dropdown-border, var(--select-border));
|
|
6969
7142
|
border-radius: var(--select-dropdown-border-radius, var(--select-radius-lg));
|
|
6970
7143
|
box-shadow: var(--select-dropdown-shadow, var(--select-shadow-lg));
|
|
6971
7144
|
z-index: var(--select-dropdown-z-index, 1000);
|
|
@@ -7056,11 +7229,11 @@ class EnhancedSelect extends HTMLElement {
|
|
|
7056
7229
|
font-size: var(--select-group-header-font-size, 0.7333em);
|
|
7057
7230
|
text-transform: var(--select-group-header-text-transform, uppercase);
|
|
7058
7231
|
letter-spacing: var(--select-group-header-letter-spacing, 0.08em);
|
|
7059
|
-
position: sticky;
|
|
7060
|
-
top: calc(var(--select-options-padding, 6px) * -1);
|
|
7232
|
+
position: var(--select-group-header-position, sticky);
|
|
7233
|
+
top: var(--select-group-header-top, calc(var(--select-options-padding, 6px) * -1));
|
|
7061
7234
|
left: 0;
|
|
7062
7235
|
right: 0;
|
|
7063
|
-
z-index: 100;
|
|
7236
|
+
z-index: var(--select-group-header-z-index, 100);
|
|
7064
7237
|
border: var(--select-group-header-border, none);
|
|
7065
7238
|
border-bottom: var(--select-group-header-border-bottom, 1px solid rgba(0, 0, 0, 0.08));
|
|
7066
7239
|
border-radius: var(--select-group-header-border-radius, 0);
|
|
@@ -7083,6 +7256,7 @@ class EnhancedSelect extends HTMLElement {
|
|
|
7083
7256
|
|
|
7084
7257
|
.option {
|
|
7085
7258
|
position: relative;
|
|
7259
|
+
z-index: var(--select-option-z-index, auto);
|
|
7086
7260
|
padding: var(--select-option-padding, 10px 14px);
|
|
7087
7261
|
cursor: pointer;
|
|
7088
7262
|
color: var(--select-option-color, var(--select-text));
|
|
@@ -7187,7 +7361,7 @@ class EnhancedSelect extends HTMLElement {
|
|
|
7187
7361
|
border: var(--select-option-disabled-border, var(--select-option-border, none));
|
|
7188
7362
|
opacity: var(--select-option-disabled-opacity, 0.5);
|
|
7189
7363
|
cursor: var(--select-option-disabled-cursor, not-allowed);
|
|
7190
|
-
pointer-events: var(--select-option-disabled-pointer-events,
|
|
7364
|
+
pointer-events: var(--select-option-disabled-pointer-events, auto);
|
|
7191
7365
|
}
|
|
7192
7366
|
|
|
7193
7367
|
.option.smilodon-option--disabled-interactive {
|
|
@@ -7251,14 +7425,14 @@ class EnhancedSelect extends HTMLElement {
|
|
|
7251
7425
|
.busy-bucket {
|
|
7252
7426
|
display: flex;
|
|
7253
7427
|
flex-direction: column;
|
|
7254
|
-
|
|
7255
|
-
|
|
7256
|
-
|
|
7257
|
-
|
|
7258
|
-
|
|
7259
|
-
|
|
7260
|
-
|
|
7261
|
-
|
|
7428
|
+
gap: var(--select-loader-gap, var(--select-busy-gap, 8px));
|
|
7429
|
+
padding: var(--select-loader-padding, var(--select-busy-padding, 20px));
|
|
7430
|
+
text-align: var(--select-loader-text-align, center);
|
|
7431
|
+
color: var(--select-loader-color, var(--select-busy-color, var(--select-text-muted)));
|
|
7432
|
+
background: var(--select-loader-bg, var(--select-busy-bg, transparent));
|
|
7433
|
+
font-size: var(--select-loader-font-size, var(--select-busy-font-size, 0.8667em));
|
|
7434
|
+
align-items: var(--select-loader-align-items, center);
|
|
7435
|
+
justify-content: var(--select-loader-justify-content, center);
|
|
7262
7436
|
}
|
|
7263
7437
|
|
|
7264
7438
|
.busy-icon {
|
|
@@ -7312,26 +7486,27 @@ class EnhancedSelect extends HTMLElement {
|
|
|
7312
7486
|
}
|
|
7313
7487
|
|
|
7314
7488
|
.searching-state {
|
|
7315
|
-
padding: var(--select-searching-padding, 32px 24px);
|
|
7316
|
-
text-align: center;
|
|
7317
|
-
color: var(--select-searching-color, var(--select-accent));
|
|
7318
|
-
font-size: var(--select-searching-font-size, 0.9333em);
|
|
7319
|
-
background: var(--select-searching-bg, transparent);
|
|
7489
|
+
padding: var(--select-loader-padding, var(--select-searching-padding, 32px 24px));
|
|
7490
|
+
text-align: var(--select-loader-text-align, center);
|
|
7491
|
+
color: var(--select-loader-color, var(--select-searching-color, var(--select-accent)));
|
|
7492
|
+
font-size: var(--select-loader-font-size, var(--select-searching-font-size, 0.9333em));
|
|
7493
|
+
background: var(--select-loader-bg, var(--select-searching-bg, transparent));
|
|
7320
7494
|
display: flex;
|
|
7321
7495
|
flex-direction: column;
|
|
7322
|
-
align-items: center;
|
|
7323
|
-
justify-content: center;
|
|
7324
|
-
gap: var(--select-searching-gap);
|
|
7496
|
+
align-items: var(--select-loader-align-items, center);
|
|
7497
|
+
justify-content: var(--select-loader-justify-content, center);
|
|
7498
|
+
gap: var(--select-loader-gap, var(--select-searching-gap, 8px));
|
|
7325
7499
|
}
|
|
7326
7500
|
|
|
7327
|
-
.searching-
|
|
7328
|
-
|
|
7501
|
+
.searching-spinner {
|
|
7502
|
+
display: inline-block;
|
|
7329
7503
|
width: var(--select-searching-spinner-size);
|
|
7330
7504
|
height: var(--select-searching-spinner-size);
|
|
7331
7505
|
border: var(--select-searching-spinner-border);
|
|
7332
7506
|
border-top-color: var(--select-searching-spinner-active-color);
|
|
7333
7507
|
border-radius: 50%;
|
|
7334
7508
|
animation: var(--select-searching-spinner-animation);
|
|
7509
|
+
flex: 0 0 auto;
|
|
7335
7510
|
}
|
|
7336
7511
|
|
|
7337
7512
|
/* ─────────────────────────────────────────────────────────────────────────
|
|
@@ -7365,14 +7540,10 @@ class EnhancedSelect extends HTMLElement {
|
|
|
7365
7540
|
}
|
|
7366
7541
|
}
|
|
7367
7542
|
|
|
7368
|
-
@media (prefers-contrast:
|
|
7369
|
-
.
|
|
7370
|
-
outline
|
|
7371
|
-
outline-
|
|
7372
|
-
}
|
|
7373
|
-
|
|
7374
|
-
.input-container {
|
|
7375
|
-
border-width: var(--select-high-contrast-border-width);
|
|
7543
|
+
@media (prefers-contrast: more) {
|
|
7544
|
+
.input-container:focus-within {
|
|
7545
|
+
outline: var(--select-high-contrast-focus-outline-width) solid var(--select-high-contrast-focus-outline-color);
|
|
7546
|
+
outline-offset: 2px;
|
|
7376
7547
|
}
|
|
7377
7548
|
|
|
7378
7549
|
.option.selected::before {
|
|
@@ -7464,7 +7635,6 @@ class EnhancedSelect extends HTMLElement {
|
|
|
7464
7635
|
:host-context([data-theme="dark"]) .input-container,
|
|
7465
7636
|
:host-context([theme="dark"]) .input-container {
|
|
7466
7637
|
background: var(--select-surface);
|
|
7467
|
-
border-color: var(--select-border);
|
|
7468
7638
|
}
|
|
7469
7639
|
|
|
7470
7640
|
:host(.dark-mode) .input-container:hover,
|
|
@@ -7493,7 +7663,7 @@ class EnhancedSelect extends HTMLElement {
|
|
|
7493
7663
|
:host-context([darkmode]) .input-container:focus-within,
|
|
7494
7664
|
:host-context([data-theme="dark"]) .input-container:focus-within,
|
|
7495
7665
|
:host-context([theme="dark"]) .input-container:focus-within {
|
|
7496
|
-
border-color: var(--select-dark-border-focus, var(--select-border-focus, #6366f1));
|
|
7666
|
+
border-color: var(--select-dark-border-focus, var(--select-input-focus-border, var(--select-border-focus, #6366f1)));
|
|
7497
7667
|
box-shadow: var(--select-dark-shadow-focus, var(--select-shadow-focus, 0 0 0 3px rgba(99, 102, 241, 0.25))), var(--select-shadow-sm);
|
|
7498
7668
|
}
|
|
7499
7669
|
|
|
@@ -7523,7 +7693,6 @@ class EnhancedSelect extends HTMLElement {
|
|
|
7523
7693
|
:host-context([data-theme="dark"]) .select-dropdown,
|
|
7524
7694
|
:host-context([theme="dark"]) .select-dropdown {
|
|
7525
7695
|
background: var(--select-dropdown-bg, var(--select-surface));
|
|
7526
|
-
border-color: var(--select-border);
|
|
7527
7696
|
}
|
|
7528
7697
|
|
|
7529
7698
|
:host(.dark-mode) .options-container,
|
|
@@ -7658,7 +7827,7 @@ class EnhancedSelect extends HTMLElement {
|
|
|
7658
7827
|
this._handleClose();
|
|
7659
7828
|
}
|
|
7660
7829
|
else if (!this._state.isOpen) {
|
|
7661
|
-
this._handleOpen();
|
|
7830
|
+
this._handleOpen('pointer');
|
|
7662
7831
|
}
|
|
7663
7832
|
};
|
|
7664
7833
|
this._arrowContainer.addEventListener('click', this._boundArrowClick);
|
|
@@ -7715,7 +7884,7 @@ class EnhancedSelect extends HTMLElement {
|
|
|
7715
7884
|
}
|
|
7716
7885
|
const wasClosed = !this._state.isOpen;
|
|
7717
7886
|
if (wasClosed) {
|
|
7718
|
-
this._handleOpen();
|
|
7887
|
+
this._handleOpen('pointer');
|
|
7719
7888
|
}
|
|
7720
7889
|
// Focus the input (do not prevent default behavior for input itself)
|
|
7721
7890
|
this._applyFocusIntent('input', 'input-container-trigger');
|
|
@@ -7752,7 +7921,7 @@ class EnhancedSelect extends HTMLElement {
|
|
|
7752
7921
|
this._suppressNextOpenClick = false;
|
|
7753
7922
|
this._multiScrollDrag.moved = false;
|
|
7754
7923
|
if (!this._state.isOpen) {
|
|
7755
|
-
this._handleOpen();
|
|
7924
|
+
this._handleOpen('pointer');
|
|
7756
7925
|
}
|
|
7757
7926
|
this._applyFocusIntent('input', 'input-container-activation');
|
|
7758
7927
|
});
|
|
@@ -7819,43 +7988,60 @@ class EnhancedSelect extends HTMLElement {
|
|
|
7819
7988
|
}
|
|
7820
7989
|
this._handleSearch(query);
|
|
7821
7990
|
});
|
|
7822
|
-
|
|
7823
|
-
|
|
7824
|
-
|
|
7825
|
-
|
|
7826
|
-
|
|
7991
|
+
const findOptionElement = (event) => {
|
|
7992
|
+
const path = typeof event.composedPath === 'function' ? event.composedPath() : [event.target];
|
|
7993
|
+
for (const node of path) {
|
|
7994
|
+
if (!(node instanceof Element))
|
|
7995
|
+
continue;
|
|
7996
|
+
if (node.matches('select-option[data-sm-index], [data-sm-selectable][data-sm-index], [data-selectable][data-index]')) {
|
|
7997
|
+
return node;
|
|
7998
|
+
}
|
|
7999
|
+
}
|
|
8000
|
+
return null;
|
|
8001
|
+
};
|
|
8002
|
+
const resolveOptionRecord = (event, option = findOptionElement(event)) => {
|
|
8003
|
+
if (!option)
|
|
8004
|
+
return null;
|
|
8005
|
+
const index = Number(option.getAttribute('data-sm-index') ?? option.getAttribute('data-index'));
|
|
8006
|
+
if (!Number.isSafeInteger(index) || index < 0)
|
|
8007
|
+
return null;
|
|
8008
|
+
this._ensureRegistryCurrent();
|
|
8009
|
+
const record = this._getRecordByIndex(index);
|
|
8010
|
+
return record ? { option, record } : null;
|
|
8011
|
+
};
|
|
8012
|
+
// Keep the input focused when a blocked disabled option is pressed. This
|
|
8013
|
+
// prevents the delayed blur-close path from racing the delegated click.
|
|
8014
|
+
this._optionsContainer.addEventListener('pointerdown', (event) => {
|
|
7827
8015
|
this._suppressBlurClose = true;
|
|
7828
8016
|
this._setLifecycleTimeout(() => {
|
|
7829
8017
|
this._suppressBlurClose = false;
|
|
7830
8018
|
}, 150); // Increased timeout to ensure click finishes before blur checks
|
|
8019
|
+
const option = findOptionElement(event);
|
|
8020
|
+
if (!option?.matches('[aria-disabled="true"], .smilodon-option--disabled, .disabled'))
|
|
8021
|
+
return;
|
|
8022
|
+
const resolved = resolveOptionRecord(event, option);
|
|
8023
|
+
if (!resolved || !resolved.record.disabled)
|
|
8024
|
+
return;
|
|
8025
|
+
if (this._getDisabledOptionBehavior().selectable)
|
|
8026
|
+
return;
|
|
8027
|
+
event.preventDefault();
|
|
7831
8028
|
});
|
|
7832
8029
|
// Delegated click listener for improved event handling (robust across shadow DOM)
|
|
7833
8030
|
const handleOptionEvent = (e) => {
|
|
7834
|
-
const
|
|
7835
|
-
|
|
7836
|
-
|
|
7837
|
-
|
|
7838
|
-
|
|
7839
|
-
|
|
7840
|
-
|
|
7841
|
-
|
|
7842
|
-
|
|
7843
|
-
}
|
|
7844
|
-
}
|
|
7845
|
-
catch (err) {
|
|
7846
|
-
continue;
|
|
7847
|
-
}
|
|
7848
|
-
}
|
|
7849
|
-
if (option && (!option.hasAttribute('aria-disabled') || option.classList.contains('smilodon-option--disabled-selectable'))) {
|
|
7850
|
-
const indexStr = option.getAttribute('data-sm-index') ?? option.getAttribute('data-index');
|
|
7851
|
-
const index = Number(indexStr);
|
|
7852
|
-
if (!Number.isNaN(index)) {
|
|
7853
|
-
this._selectOption(index, {
|
|
7854
|
-
shiftKey: e.shiftKey,
|
|
7855
|
-
toggleKey: e.ctrlKey || e.metaKey,
|
|
7856
|
-
});
|
|
7857
|
-
}
|
|
8031
|
+
const resolved = resolveOptionRecord(e);
|
|
8032
|
+
if (!resolved)
|
|
8033
|
+
return;
|
|
8034
|
+
const behavior = this._getDisabledOptionBehavior();
|
|
8035
|
+
if (resolved.record.disabled && !behavior.selectable) {
|
|
8036
|
+
e.preventDefault();
|
|
8037
|
+
if (behavior.closeOnClick)
|
|
8038
|
+
this._handleClose('disabled-option-click');
|
|
8039
|
+
return;
|
|
7858
8040
|
}
|
|
8041
|
+
this._selectOption(resolved.record.index, {
|
|
8042
|
+
shiftKey: e.shiftKey,
|
|
8043
|
+
toggleKey: e.ctrlKey || e.metaKey,
|
|
8044
|
+
});
|
|
7859
8045
|
};
|
|
7860
8046
|
this._optionsContainer.addEventListener('click', handleOptionEvent);
|
|
7861
8047
|
// Keyboard navigation
|
|
@@ -8369,7 +8555,7 @@ class EnhancedSelect extends HTMLElement {
|
|
|
8369
8555
|
},
|
|
8370
8556
|
}, { applyFocus: true });
|
|
8371
8557
|
}
|
|
8372
|
-
_handleOpen() {
|
|
8558
|
+
_handleOpen(intent = 'default') {
|
|
8373
8559
|
if (!this._config.enabled) {
|
|
8374
8560
|
this._runEngineEffects(this._engine.dispatch({ type: 'DISABLED_CHANGED', disabled: true }));
|
|
8375
8561
|
return;
|
|
@@ -8403,10 +8589,17 @@ class EnhancedSelect extends HTMLElement {
|
|
|
8403
8589
|
this._liftStackingAncestors();
|
|
8404
8590
|
this._dropdown.style.display = 'block';
|
|
8405
8591
|
this._updateArrowRotation();
|
|
8592
|
+
// Pointer opening must not turn the previous selection or stale active key
|
|
8593
|
+
// into a synthetic hover-like highlight. Clear engine identity before the
|
|
8594
|
+
// options are rendered so built-in and custom renderers share the same state.
|
|
8595
|
+
if (intent === 'pointer') {
|
|
8596
|
+
this._dispatchActiveKey(null, 'open', 'pointer dropdown open');
|
|
8597
|
+
}
|
|
8406
8598
|
// Render options when opening
|
|
8407
8599
|
this._renderOptions();
|
|
8408
8600
|
this._syncDropdownPlacement();
|
|
8409
|
-
|
|
8601
|
+
if (intent !== 'pointer')
|
|
8602
|
+
this._setInitialActiveOption();
|
|
8410
8603
|
this._emit('open', {});
|
|
8411
8604
|
this._config.callbacks.onOpen?.();
|
|
8412
8605
|
this._announce('Options expanded');
|
|
@@ -9491,7 +9684,7 @@ class EnhancedSelect extends HTMLElement {
|
|
|
9491
9684
|
const selectableIndices = this._getSelectableOptionIndices();
|
|
9492
9685
|
const selected = Array.from(this._state.selectedIndices).sort((a, b) => a - b);
|
|
9493
9686
|
// Opening an empty select must not implicitly assign an active descendant.
|
|
9494
|
-
// Keyboard navigation and
|
|
9687
|
+
// Keyboard navigation and option interaction establish active identity.
|
|
9495
9688
|
if (selectableIndices.length === 0 || selected.length === 0) {
|
|
9496
9689
|
this._dispatchActiveKey(null, 'open', 'initial active option');
|
|
9497
9690
|
return;
|
|
@@ -9702,6 +9895,7 @@ class EnhancedSelect extends HTMLElement {
|
|
|
9702
9895
|
this._chipElements.delete(key);
|
|
9703
9896
|
expected.remove();
|
|
9704
9897
|
if (this.isConnected) {
|
|
9898
|
+
this._syncMultiSelectPlaceholderVisibility();
|
|
9705
9899
|
this._observeSelectedLabelTooltipTargets();
|
|
9706
9900
|
this._refreshSelectedLabelTooltipMeasurements();
|
|
9707
9901
|
}
|
|
@@ -9871,6 +10065,21 @@ class EnhancedSelect extends HTMLElement {
|
|
|
9871
10065
|
nextSibling = badge;
|
|
9872
10066
|
}
|
|
9873
10067
|
}
|
|
10068
|
+
this._syncMultiSelectPlaceholderVisibility();
|
|
10069
|
+
}
|
|
10070
|
+
_syncMultiSelectPlaceholderVisibility() {
|
|
10071
|
+
if (this._config.selection.mode !== 'multi')
|
|
10072
|
+
return;
|
|
10073
|
+
const hasLogicalSelection = this._getSelectedEntries().length > 0;
|
|
10074
|
+
const hasMountedChipPresentation = this._inputContent.querySelector('.selection-badge') !== null;
|
|
10075
|
+
const isEmpty = !hasLogicalSelection && !hasMountedChipPresentation;
|
|
10076
|
+
this._input.placeholder = isEmpty
|
|
10077
|
+
? (this._config.placeholder || 'Select an option...')
|
|
10078
|
+
: '';
|
|
10079
|
+
if (isEmpty
|
|
10080
|
+
&& (this._config.multiSelectDisplay?.mode ?? 'wrap') === 'horizontal') {
|
|
10081
|
+
this._inputContent.scrollLeft = 0;
|
|
10082
|
+
}
|
|
9874
10083
|
}
|
|
9875
10084
|
_updateInputDisplay() {
|
|
9876
10085
|
const selectedEntries = this._getSelectedEntries();
|
|
@@ -9899,14 +10108,8 @@ class EnhancedSelect extends HTMLElement {
|
|
|
9899
10108
|
this._cancelLatestChipScroll();
|
|
9900
10109
|
const getLabel = this._config.serverSide.getLabelFromItem || ((item) => item?.label ?? String(item));
|
|
9901
10110
|
if (this._config.selection.mode === 'multi') {
|
|
9902
|
-
|
|
9903
|
-
|
|
9904
|
-
this._input.placeholder = this._config.placeholder || 'Select an option...';
|
|
9905
|
-
}
|
|
9906
|
-
else {
|
|
9907
|
-
this._input.value = '';
|
|
9908
|
-
this._input.placeholder = '';
|
|
9909
|
-
}
|
|
10111
|
+
this._input.value = '';
|
|
10112
|
+
this._input.placeholder = '';
|
|
9910
10113
|
this._renderSelectedChips(selectedEntries);
|
|
9911
10114
|
}
|
|
9912
10115
|
else {
|
|
@@ -9928,7 +10131,10 @@ class EnhancedSelect extends HTMLElement {
|
|
|
9928
10131
|
}
|
|
9929
10132
|
// Preserve manual scrolling. Only a newly selected key can request auto-scroll.
|
|
9930
10133
|
if (this._config.selection.mode === 'multi') {
|
|
9931
|
-
this._inputContent.
|
|
10134
|
+
const hasMountedChipPresentation = this._inputContent.querySelector('.selection-badge') !== null;
|
|
10135
|
+
this._inputContent.scrollLeft = selectedEntries.length === 0 && !hasMountedChipPresentation
|
|
10136
|
+
? 0
|
|
10137
|
+
: previousChipScrollLeft;
|
|
9932
10138
|
if (newlyAddedKey !== undefined)
|
|
9933
10139
|
this._scheduleLatestChipScroll(newlyAddedKey);
|
|
9934
10140
|
}
|
|
@@ -10716,7 +10922,10 @@ class EnhancedSelect extends HTMLElement {
|
|
|
10716
10922
|
if (this._input) {
|
|
10717
10923
|
this._input.readOnly = !this._config.searchable;
|
|
10718
10924
|
this._syncComboboxAccessibility();
|
|
10719
|
-
if (this.
|
|
10925
|
+
if (this._config.selection.mode === 'multi') {
|
|
10926
|
+
this._syncMultiSelectPlaceholderVisibility();
|
|
10927
|
+
}
|
|
10928
|
+
else if (this._state.selectedIndices.size === 0) {
|
|
10720
10929
|
this._input.placeholder = this._config.placeholder || 'Select an option...';
|
|
10721
10930
|
}
|
|
10722
10931
|
}
|
|
@@ -10733,6 +10942,7 @@ class EnhancedSelect extends HTMLElement {
|
|
|
10733
10942
|
}
|
|
10734
10943
|
}
|
|
10735
10944
|
this._syncStyleConfigVariables();
|
|
10945
|
+
this._syncDropdownConfigInlineStyles();
|
|
10736
10946
|
this._syncListboxAccessibility();
|
|
10737
10947
|
if (this.isConnected) {
|
|
10738
10948
|
this._syncDirectionConfig();
|
|
@@ -12098,8 +12308,12 @@ class EnhancedSelect extends HTMLElement {
|
|
|
12098
12308
|
_createBusyBucket() {
|
|
12099
12309
|
const bucket = document.createElement('div');
|
|
12100
12310
|
bucket.setAttribute('part', 'loading');
|
|
12311
|
+
bucket.setAttribute('role', 'status');
|
|
12312
|
+
bucket.setAttribute('aria-live', 'polite');
|
|
12313
|
+
bucket.setAttribute('aria-atomic', 'true');
|
|
12101
12314
|
bucket.className = 'busy-bucket';
|
|
12102
12315
|
this._busyBucket = bucket;
|
|
12316
|
+
this._syncLoaderClassNames();
|
|
12103
12317
|
const icon = document.createElement('div');
|
|
12104
12318
|
icon.className = 'busy-icon';
|
|
12105
12319
|
icon.setAttribute('part', 'loading-icon');
|
|
@@ -12147,6 +12361,25 @@ class EnhancedSelect extends HTMLElement {
|
|
|
12147
12361
|
this._syncBusyBucketContent(bucket);
|
|
12148
12362
|
return bucket;
|
|
12149
12363
|
}
|
|
12364
|
+
_createSearchingState() {
|
|
12365
|
+
const searching = document.createElement('div');
|
|
12366
|
+
searching.className = 'searching-state';
|
|
12367
|
+
searching.setAttribute('part', 'loading searching');
|
|
12368
|
+
searching.setAttribute('role', 'status');
|
|
12369
|
+
searching.setAttribute('aria-live', 'polite');
|
|
12370
|
+
searching.setAttribute('aria-atomic', 'true');
|
|
12371
|
+
const spinner = document.createElement('span');
|
|
12372
|
+
spinner.className = 'searching-spinner';
|
|
12373
|
+
spinner.setAttribute('part', 'searching-spinner');
|
|
12374
|
+
spinner.setAttribute('aria-hidden', 'true');
|
|
12375
|
+
const message = document.createElement('span');
|
|
12376
|
+
message.className = 'searching-message';
|
|
12377
|
+
message.setAttribute('part', 'searching-message');
|
|
12378
|
+
message.textContent = this._config.searchingMessage ?? 'Searching...';
|
|
12379
|
+
searching.append(spinner, message);
|
|
12380
|
+
this._syncLoaderClassNames(searching);
|
|
12381
|
+
return searching;
|
|
12382
|
+
}
|
|
12150
12383
|
_renderOptions() {
|
|
12151
12384
|
this._syncBusyPresentation();
|
|
12152
12385
|
this._clearBusyBucketContentObserver();
|
|
@@ -12189,10 +12422,7 @@ class EnhancedSelect extends HTMLElement {
|
|
|
12189
12422
|
this._renderPlan = this._createLegacyRenderPlan([]);
|
|
12190
12423
|
this._refreshVirtualizationScope(filteredIndicesForScope);
|
|
12191
12424
|
this._syncLegacyActiveAria();
|
|
12192
|
-
const searching =
|
|
12193
|
-
searching.className = 'searching-state';
|
|
12194
|
-
searching.setAttribute('part', 'loading');
|
|
12195
|
-
searching.textContent = 'Searching...';
|
|
12425
|
+
const searching = this._createSearchingState();
|
|
12196
12426
|
this._optionsContainer.appendChild(searching);
|
|
12197
12427
|
this._syncEmptyStateContext(null);
|
|
12198
12428
|
this._resolveRenderCycle(renderCycleId, true);
|
|
@@ -12672,6 +12902,7 @@ class EnhancedSelect extends HTMLElement {
|
|
|
12672
12902
|
_addLoadMoreTrigger() {
|
|
12673
12903
|
const container = document.createElement('div');
|
|
12674
12904
|
container.className = 'load-more-container';
|
|
12905
|
+
container.setAttribute('part', 'load-more-container');
|
|
12675
12906
|
if (this._dataRequestCoordinator) {
|
|
12676
12907
|
const shouldObserve = this._config.infiniteScroll.enabled
|
|
12677
12908
|
&& Boolean(this._intersectionObserver)
|
|
@@ -12683,6 +12914,7 @@ class EnhancedSelect extends HTMLElement {
|
|
|
12683
12914
|
sentinel.style.height = '10px';
|
|
12684
12915
|
sentinel.style.width = '100%';
|
|
12685
12916
|
sentinel.style.opacity = '0';
|
|
12917
|
+
sentinel.setAttribute('aria-hidden', 'true');
|
|
12686
12918
|
this._acknowledgedSentinel = sentinel;
|
|
12687
12919
|
this._loadMoreTrigger = sentinel;
|
|
12688
12920
|
container.appendChild(sentinel);
|
|
@@ -12692,7 +12924,8 @@ class EnhancedSelect extends HTMLElement {
|
|
|
12692
12924
|
if (this._config.loadMore.enabled || this._config.infiniteScroll.enabled) {
|
|
12693
12925
|
const button = document.createElement('button');
|
|
12694
12926
|
button.className = 'load-more-button';
|
|
12695
|
-
button.
|
|
12927
|
+
button.setAttribute('part', 'load-more-button');
|
|
12928
|
+
button.textContent = this._config.loadMore.label ?? `Load ${this._config.loadMore.itemsPerLoad} more`;
|
|
12696
12929
|
button.addEventListener('click', () => this._loadMoreItems('manual'));
|
|
12697
12930
|
container.appendChild(button);
|
|
12698
12931
|
if (!sentinel)
|
|
@@ -12720,6 +12953,7 @@ class EnhancedSelect extends HTMLElement {
|
|
|
12720
12953
|
sentinel.style.height = '10px';
|
|
12721
12954
|
sentinel.style.width = '100%';
|
|
12722
12955
|
sentinel.style.opacity = '0'; // Invisible
|
|
12956
|
+
sentinel.setAttribute('aria-hidden', 'true');
|
|
12723
12957
|
this._loadMoreTrigger = sentinel;
|
|
12724
12958
|
container.appendChild(sentinel);
|
|
12725
12959
|
}
|
|
@@ -12727,7 +12961,8 @@ class EnhancedSelect extends HTMLElement {
|
|
|
12727
12961
|
// Manual Load More: Render a button
|
|
12728
12962
|
const button = document.createElement('button');
|
|
12729
12963
|
button.className = 'load-more-button';
|
|
12730
|
-
button.
|
|
12964
|
+
button.setAttribute('part', 'load-more-button');
|
|
12965
|
+
button.textContent = this._config.loadMore.label ?? `Load ${this._config.loadMore.itemsPerLoad} more`;
|
|
12731
12966
|
button.addEventListener('click', () => this._loadMoreItems());
|
|
12732
12967
|
this._loadMoreTrigger = button;
|
|
12733
12968
|
container.appendChild(button);
|