@smilodon/core 1.10.2 → 1.11.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 +18 -0
- package/dist/index.cjs +33 -17
- package/dist/index.cjs.map +1 -1
- package/dist/index.js +33 -17
- 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 +33 -17
- 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/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -2604,14 +2604,13 @@ class SelectOption extends HTMLElement {
|
|
|
2604
2604
|
transition: var(--select-option-transition, background-color 0.2s ease);
|
|
2605
2605
|
}
|
|
2606
2606
|
|
|
2607
|
-
:host(:hover
|
|
2607
|
+
:host(:hover:not(.smilodon-option--disabled):not([aria-disabled="true"])),
|
|
2608
2608
|
:host(.smilodon-option--disabled-hoverable:hover) {
|
|
2609
2609
|
background: var(--select-option-hover-bg, #f0f0f0);
|
|
2610
2610
|
color: var(--select-option-hover-color, var(--select-option-color, var(--select-text-color, #1f2937)));
|
|
2611
|
-
|
|
2612
|
-
|
|
2611
|
+
outline: var(--select-option-hover-border, none);
|
|
2612
|
+
outline-offset: -1px;
|
|
2613
2613
|
box-shadow: var(--select-option-hover-shadow, var(--select-option-shadow, none));
|
|
2614
|
-
transform: var(--select-option-hover-transform, var(--select-option-transform, none));
|
|
2615
2614
|
}
|
|
2616
2615
|
|
|
2617
2616
|
/* Keep the visual surface on the host so external utility classes applied
|
|
@@ -2632,10 +2631,9 @@ class SelectOption extends HTMLElement {
|
|
|
2632
2631
|
:host(.smilodon-option--selected:hover) {
|
|
2633
2632
|
background: var(--select-option-selected-hover-bg, var(--select-option-selected-bg, #e3f2fd));
|
|
2634
2633
|
color: var(--select-option-selected-hover-color, var(--select-option-selected-color, #1976d2));
|
|
2635
|
-
|
|
2636
|
-
|
|
2634
|
+
outline: var(--select-option-selected-hover-border, var(--select-option-hover-border, none));
|
|
2635
|
+
outline-offset: -1px;
|
|
2637
2636
|
box-shadow: var(--select-option-selected-hover-shadow, var(--select-option-selected-shadow, var(--select-option-shadow, none)));
|
|
2638
|
-
transform: var(--select-option-selected-hover-transform, var(--select-option-selected-transform, var(--select-option-transform, none)));
|
|
2639
2637
|
}
|
|
2640
2638
|
|
|
2641
2639
|
:host(.smilodon-option--active):not(.smilodon-option--disabled):not([aria-disabled="true"]),
|
|
@@ -5492,10 +5490,21 @@ class EnhancedSelect extends HTMLElement {
|
|
|
5492
5490
|
const container = document.createElement('div');
|
|
5493
5491
|
container.className = 'dropdown-arrow-container';
|
|
5494
5492
|
container.innerHTML = `
|
|
5495
|
-
<
|
|
5496
|
-
<
|
|
5497
|
-
|
|
5493
|
+
<slot name="arrow">
|
|
5494
|
+
<svg class="dropdown-arrow" part="arrow" viewBox="0 0 16 16" fill="none" xmlns="http://www.w3.org/2000/svg" aria-hidden="true">
|
|
5495
|
+
<path d="M4 6L8 10L12 6" stroke="currentColor" stroke-width="1.5" stroke-linecap="round" stroke-linejoin="round"/>
|
|
5496
|
+
</svg>
|
|
5497
|
+
</slot>
|
|
5498
5498
|
`;
|
|
5499
|
+
const slot = container.querySelector('slot[name="arrow"]');
|
|
5500
|
+
slot?.addEventListener('slotchange', () => {
|
|
5501
|
+
if (slot.assignedElements({ flatten: true }).length > 0) {
|
|
5502
|
+
this.setAttribute('data-custom-arrow', 'true');
|
|
5503
|
+
}
|
|
5504
|
+
else {
|
|
5505
|
+
this.removeAttribute('data-custom-arrow');
|
|
5506
|
+
}
|
|
5507
|
+
});
|
|
5499
5508
|
return container;
|
|
5500
5509
|
}
|
|
5501
5510
|
_createClearControl() {
|
|
@@ -5651,7 +5660,7 @@ class EnhancedSelect extends HTMLElement {
|
|
|
5651
5660
|
--select-scrollbar-width: 6px;
|
|
5652
5661
|
--select-scrollbar-thumb-radius: 3px;
|
|
5653
5662
|
--select-option-hover-enabled: 1;
|
|
5654
|
-
--select-option-hover-transform:
|
|
5663
|
+
--select-option-hover-transform: none;
|
|
5655
5664
|
--select-option-font-weight: 450;
|
|
5656
5665
|
--select-option-margin: 2px 0;
|
|
5657
5666
|
--select-input-font-size: inherit;
|
|
@@ -6210,6 +6219,10 @@ class EnhancedSelect extends HTMLElement {
|
|
|
6210
6219
|
.dropdown-arrow-container:hover {
|
|
6211
6220
|
background-color: var(--select-arrow-hover-bg, rgba(15, 52, 96, 0.05));
|
|
6212
6221
|
}
|
|
6222
|
+
|
|
6223
|
+
:host([data-custom-arrow="true"]) .dropdown-arrow-container:hover {
|
|
6224
|
+
background-color: transparent;
|
|
6225
|
+
}
|
|
6213
6226
|
|
|
6214
6227
|
.dropdown-arrow {
|
|
6215
6228
|
width: var(--select-arrow-width, var(--select-arrow-size, 16px));
|
|
@@ -6431,8 +6444,7 @@ class EnhancedSelect extends HTMLElement {
|
|
|
6431
6444
|
transition: var(--select-option-transition,
|
|
6432
6445
|
background var(--select-transition-fast),
|
|
6433
6446
|
color var(--select-transition-fast),
|
|
6434
|
-
|
|
6435
|
-
transform var(--select-transition-fast),
|
|
6447
|
+
outline-color var(--select-transition-fast),
|
|
6436
6448
|
box-shadow var(--select-transition-fast)
|
|
6437
6449
|
);
|
|
6438
6450
|
user-select: none;
|
|
@@ -6446,9 +6458,10 @@ class EnhancedSelect extends HTMLElement {
|
|
|
6446
6458
|
.option:hover:not(.disabled):not(.smilodon-option--disabled),
|
|
6447
6459
|
.option.smilodon-option--disabled-hoverable:hover {
|
|
6448
6460
|
background: var(--select-option-hover-bg, var(--select-surface-elevated));
|
|
6449
|
-
|
|
6461
|
+
/* Hover decoration must not resize or translate the pointer hit target. */
|
|
6462
|
+
outline: var(--select-option-hover-border, none);
|
|
6463
|
+
outline-offset: -1px;
|
|
6450
6464
|
color: var(--select-option-hover-color, var(--select-text));
|
|
6451
|
-
transform: var(--select-option-hover-transform, none);
|
|
6452
6465
|
}
|
|
6453
6466
|
|
|
6454
6467
|
.option.selected {
|
|
@@ -6491,7 +6504,8 @@ class EnhancedSelect extends HTMLElement {
|
|
|
6491
6504
|
|
|
6492
6505
|
.option.selected:hover {
|
|
6493
6506
|
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%)));
|
|
6494
|
-
|
|
6507
|
+
outline: var(--select-option-selected-hover-border, var(--select-option-hover-border, none));
|
|
6508
|
+
outline-offset: -1px;
|
|
6495
6509
|
color: var(--select-option-selected-hover-color, var(--select-option-selected-color, var(--select-accent)));
|
|
6496
6510
|
}
|
|
6497
6511
|
|
|
@@ -7921,7 +7935,9 @@ class EnhancedSelect extends HTMLElement {
|
|
|
7921
7935
|
_setInitialActiveOption() {
|
|
7922
7936
|
const selectableIndices = this._getSelectableOptionIndices();
|
|
7923
7937
|
const selected = Array.from(this._state.selectedIndices).sort((a, b) => a - b);
|
|
7924
|
-
|
|
7938
|
+
// Opening an empty select must not implicitly assign an active descendant.
|
|
7939
|
+
// Keyboard navigation and pointer interaction establish active identity.
|
|
7940
|
+
if (selectableIndices.length === 0 || selected.length === 0) {
|
|
7925
7941
|
this._dispatchActiveKey(null, 'open', 'initial active option');
|
|
7926
7942
|
return;
|
|
7927
7943
|
}
|