@smilodon/core 1.5.0 → 1.5.3
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 +116 -0
- package/dist/index.cjs +96 -27
- package/dist/index.cjs.map +1 -1
- package/dist/index.js +96 -27
- 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 +96 -27
- 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 +1 -0
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -2719,7 +2719,7 @@ class EnhancedSelect extends HTMLElement {
|
|
|
2719
2719
|
--select-accent: #0f3460;
|
|
2720
2720
|
--select-accent-hover: #e94560;
|
|
2721
2721
|
--select-surface: #ffffff;
|
|
2722
|
-
--select-surface-elevated:
|
|
2722
|
+
--select-surface-elevated: rgba(0, 0, 0, 0.04);
|
|
2723
2723
|
--select-border: #e1e5eb;
|
|
2724
2724
|
--select-border-focus: #0f3460;
|
|
2725
2725
|
--select-text: #1a1a2e;
|
|
@@ -2767,8 +2767,13 @@ class EnhancedSelect extends HTMLElement {
|
|
|
2767
2767
|
--select-multi-input-horizontal-cursor: grab;
|
|
2768
2768
|
--select-multi-input-horizontal-active-cursor: grabbing;
|
|
2769
2769
|
--select-multi-separator-inset-block: 10px;
|
|
2770
|
+
--select-multi-separator-height: auto;
|
|
2770
2771
|
--select-multi-action-surface-bg: var(--select-input-bg, var(--select-surface));
|
|
2771
2772
|
--select-multi-action-divider: 1px solid var(--select-border);
|
|
2773
|
+
--select-separator-width: 1px;
|
|
2774
|
+
--select-separator-inset-block: 10px;
|
|
2775
|
+
--select-separator-height: auto;
|
|
2776
|
+
--select-separator-display: block;
|
|
2772
2777
|
--select-separator-opacity: 0.6;
|
|
2773
2778
|
--select-separator-active-opacity: 1;
|
|
2774
2779
|
--select-separator-position: var(--select-arrow-width, 42px);
|
|
@@ -2799,9 +2804,16 @@ class EnhancedSelect extends HTMLElement {
|
|
|
2799
2804
|
--select-dropdown-transform-origin: top center;
|
|
2800
2805
|
--select-scrollbar-width: 6px;
|
|
2801
2806
|
--select-scrollbar-thumb-radius: 3px;
|
|
2807
|
+
--select-option-hover-enabled: 1;
|
|
2802
2808
|
--select-option-hover-transform: translateX(2px);
|
|
2803
2809
|
--select-option-font-weight: 450;
|
|
2804
2810
|
--select-option-margin: 2px 0;
|
|
2811
|
+
--select-input-font-size: inherit;
|
|
2812
|
+
--select-input-font-weight: 400;
|
|
2813
|
+
--select-multi-container-padding: 6px;
|
|
2814
|
+
--select-input-font-size: inherit;
|
|
2815
|
+
--select-input-font-weight: 400;
|
|
2816
|
+
--select-multi-container-padding: 6px;
|
|
2805
2817
|
--select-option-disabled-opacity: 0.5;
|
|
2806
2818
|
--select-option-disabled-cursor: not-allowed;
|
|
2807
2819
|
--select-option-active-outline-offset: -2px;
|
|
@@ -2834,9 +2846,9 @@ class EnhancedSelect extends HTMLElement {
|
|
|
2834
2846
|
--select-searching-spinner-size: 24px;
|
|
2835
2847
|
--select-searching-spinner-border: 2px solid var(--select-border);
|
|
2836
2848
|
--select-searching-spinner-animation: var(--select-spinner-animation);
|
|
2837
|
-
--select-group-header-separator-margin-top:
|
|
2838
|
-
--select-group-header-separator-padding-top:
|
|
2839
|
-
--select-group-header-separator-border-top:
|
|
2849
|
+
--select-group-header-separator-margin-top: 0;
|
|
2850
|
+
--select-group-header-separator-padding-top: 0;
|
|
2851
|
+
--select-group-header-separator-border-top: none;
|
|
2840
2852
|
--select-reduced-motion-duration: 0.01ms;
|
|
2841
2853
|
--select-reduced-motion-iteration-count: 1;
|
|
2842
2854
|
--select-high-contrast-border-width: 2px;
|
|
@@ -3038,9 +3050,13 @@ class EnhancedSelect extends HTMLElement {
|
|
|
3038
3050
|
min-height: var(--select-input-min-height, 48px);
|
|
3039
3051
|
max-height: var(--select-input-max-height, 160px);
|
|
3040
3052
|
overflow: hidden;
|
|
3053
|
+
padding: var(--select-multi-container-padding, 6px);
|
|
3041
3054
|
align-content: var(--select-input-align-content, center);
|
|
3042
3055
|
text-align: var(--select-input-text-align, start);
|
|
3043
3056
|
background: var(--select-input-bg, var(--select-surface));
|
|
3057
|
+
font-size: var(--select-input-font-size, inherit);
|
|
3058
|
+
font-weight: var(--select-input-font-weight, 400);
|
|
3059
|
+
font-weight: var(--select-input-font-weight, 400);
|
|
3044
3060
|
border: var(--select-input-border, 1.5px solid var(--select-border));
|
|
3045
3061
|
border-radius: var(--select-input-border-radius, var(--select-radius-md));
|
|
3046
3062
|
box-shadow: var(--select-shadow-sm);
|
|
@@ -3092,10 +3108,9 @@ class EnhancedSelect extends HTMLElement {
|
|
|
3092
3108
|
}
|
|
3093
3109
|
|
|
3094
3110
|
.input-container.input-container--multi::after {
|
|
3095
|
-
top: var(--select-multi-separator-inset-block, 10px);
|
|
3096
|
-
bottom: var(--select-multi-separator-inset-block, 10px);
|
|
3097
|
-
height: auto;
|
|
3098
|
-
transform: none;
|
|
3111
|
+
top: var(--select-multi-separator-inset-block, var(--select-separator-inset-block, 10px));
|
|
3112
|
+
bottom: var(--select-multi-separator-inset-block, var(--select-separator-inset-block, 10px));
|
|
3113
|
+
height: var(--select-multi-separator-height, auto);
|
|
3099
3114
|
}
|
|
3100
3115
|
|
|
3101
3116
|
.input-container.input-container--multi[data-multi-scroll-mode="horizontal"] {
|
|
@@ -3160,12 +3175,13 @@ class EnhancedSelect extends HTMLElement {
|
|
|
3160
3175
|
/* Elegant separator line before arrow */
|
|
3161
3176
|
.input-container::after {
|
|
3162
3177
|
content: '';
|
|
3178
|
+
display: var(--select-separator-display, block);
|
|
3163
3179
|
position: absolute;
|
|
3164
|
-
top:
|
|
3180
|
+
top: var(--select-separator-inset-block, 10px);
|
|
3181
|
+
bottom: var(--select-separator-inset-block, 10px);
|
|
3165
3182
|
right: var(--select-separator-position, var(--select-arrow-width, 42px));
|
|
3166
|
-
transform: translateY(-50%);
|
|
3167
3183
|
width: var(--select-separator-width, 1px);
|
|
3168
|
-
height: var(--select-separator-height,
|
|
3184
|
+
height: var(--select-separator-height, auto);
|
|
3169
3185
|
background: var(--select-separator-bg, linear-gradient(
|
|
3170
3186
|
to bottom,
|
|
3171
3187
|
transparent 0%,
|
|
@@ -3476,22 +3492,26 @@ class EnhancedSelect extends HTMLElement {
|
|
|
3476
3492
|
───────────────────────────────────────────────────────────────────────── */
|
|
3477
3493
|
|
|
3478
3494
|
.group-header {
|
|
3479
|
-
padding: var(--select-group-header-padding, 10px 12px
|
|
3480
|
-
margin: var(--select-group-header-margin, 0);
|
|
3495
|
+
padding: var(--select-group-header-padding, 10px 12px 8px 12px);
|
|
3496
|
+
margin: var(--select-group-header-margin, 0 calc(var(--select-options-padding, 6px) * -1));
|
|
3481
3497
|
font-weight: var(--select-group-header-weight, 600);
|
|
3482
3498
|
color: var(--select-group-header-color, var(--select-text-muted));
|
|
3483
|
-
background
|
|
3499
|
+
background: var(--select-group-header-bg, #ffffff);
|
|
3484
3500
|
text-align: var(--select-group-header-text-align, left);
|
|
3485
3501
|
font-size: var(--select-group-header-font-size, 0.7333em);
|
|
3486
3502
|
text-transform: var(--select-group-header-text-transform, uppercase);
|
|
3487
3503
|
letter-spacing: var(--select-group-header-letter-spacing, 0.08em);
|
|
3488
3504
|
position: sticky;
|
|
3489
|
-
top:
|
|
3490
|
-
|
|
3505
|
+
top: calc(var(--select-options-padding, 6px) * -1);
|
|
3506
|
+
left: 0;
|
|
3507
|
+
right: 0;
|
|
3508
|
+
z-index: 100;
|
|
3491
3509
|
border: var(--select-group-header-border, none);
|
|
3492
|
-
border-bottom: var(--select-group-header-border-bottom,
|
|
3510
|
+
border-bottom: var(--select-group-header-border-bottom, 1px solid rgba(0, 0, 0, 0.08));
|
|
3493
3511
|
border-radius: var(--select-group-header-border-radius, 0);
|
|
3494
|
-
box-shadow: var(--select-group-header-shadow,
|
|
3512
|
+
box-shadow: var(--select-group-header-shadow, 0 1px 2px rgba(0, 0, 0, 0.04));
|
|
3513
|
+
/* Force solid background to prevent option bleed-through */
|
|
3514
|
+
isolation: isolate;
|
|
3495
3515
|
}
|
|
3496
3516
|
|
|
3497
3517
|
.group-header:not(:first-child) {
|
|
@@ -3511,13 +3531,15 @@ class EnhancedSelect extends HTMLElement {
|
|
|
3511
3531
|
color: var(--select-option-color, var(--select-text));
|
|
3512
3532
|
background: var(--select-option-bg, transparent);
|
|
3513
3533
|
border: var(--select-option-border, none);
|
|
3534
|
+
box-sizing: border-box;
|
|
3514
3535
|
text-align: var(--select-option-text-align, start);
|
|
3515
|
-
transition:
|
|
3536
|
+
transition: var(--select-option-transition,
|
|
3516
3537
|
background var(--select-transition-fast),
|
|
3517
3538
|
color var(--select-transition-fast),
|
|
3518
|
-
border
|
|
3539
|
+
border var(--select-transition-fast),
|
|
3519
3540
|
transform var(--select-transition-fast),
|
|
3520
|
-
box-shadow var(--select-transition-fast)
|
|
3541
|
+
box-shadow var(--select-transition-fast)
|
|
3542
|
+
);
|
|
3521
3543
|
user-select: none;
|
|
3522
3544
|
font-size: var(--select-option-font-size, inherit);
|
|
3523
3545
|
font-weight: var(--select-option-font-weight);
|
|
@@ -3530,7 +3552,7 @@ class EnhancedSelect extends HTMLElement {
|
|
|
3530
3552
|
background: var(--select-option-hover-bg, var(--select-surface-elevated));
|
|
3531
3553
|
border: var(--select-option-hover-border, var(--select-option-border, none));
|
|
3532
3554
|
color: var(--select-option-hover-color, var(--select-text));
|
|
3533
|
-
transform: var(--select-option-hover-transform);
|
|
3555
|
+
transform: var(--select-option-hover-transform, none);
|
|
3534
3556
|
}
|
|
3535
3557
|
|
|
3536
3558
|
.option.selected {
|
|
@@ -3794,14 +3816,34 @@ class EnhancedSelect extends HTMLElement {
|
|
|
3794
3816
|
|
|
3795
3817
|
--select-dropdown-bg: var(--select-dark-dropdown-bg, var(--select-surface));
|
|
3796
3818
|
|
|
3819
|
+
--select-arrow-color: var(--select-dark-arrow-color, #9ca3af);
|
|
3820
|
+
--select-arrow-hover-color: var(--select-dark-arrow-hover-color, #f5f5f5);
|
|
3821
|
+
--select-arrow-bg: var(--select-dark-arrow-bg, transparent);
|
|
3822
|
+
--select-arrow-hover-bg: var(--select-dark-arrow-hover-bg, rgba(156, 163, 175, 0.15));
|
|
3823
|
+
|
|
3824
|
+
--select-separator-bg: var(--select-dark-separator-bg, var(--select-separator-dark-bg));
|
|
3825
|
+
--select-separator-width: var(--select-dark-separator-width, 1px);
|
|
3826
|
+
|
|
3827
|
+
--select-badge-bg: var(--select-dark-badge-bg, rgba(99, 102, 241, 0.2));
|
|
3828
|
+
--select-badge-color: var(--select-dark-badge-color, #e0e7ff);
|
|
3829
|
+
|
|
3830
|
+
--select-group-header-bg: var(--select-group-header-dark-bg, #1a1a2e);
|
|
3831
|
+
--select-group-header-color: var(--select-group-header-dark-color, #9ca3af);
|
|
3832
|
+
|
|
3833
|
+
--select-empty-color: var(--select-dark-empty-color, #9ca3af);
|
|
3834
|
+
|
|
3797
3835
|
--select-option-bg: var(--select-dark-option-bg, transparent);
|
|
3798
3836
|
--select-option-color: var(--select-dark-option-color, var(--select-text));
|
|
3837
|
+
--select-option-border: var(--select-dark-option-border, none);
|
|
3799
3838
|
--select-option-hover-bg: var(--select-dark-option-hover-bg, var(--select-surface-elevated));
|
|
3800
3839
|
--select-option-hover-color: var(--select-dark-option-hover-color, var(--select-text));
|
|
3840
|
+
--select-option-hover-border: var(--select-dark-option-hover-border, var(--select-option-border, none));
|
|
3801
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%));
|
|
3802
3842
|
--select-option-selected-color: var(--select-dark-option-selected-color, #a5b4fc);
|
|
3843
|
+
--select-option-selected-border: var(--select-dark-option-selected-border, var(--select-option-border, none));
|
|
3803
3844
|
--select-option-selected-hover-bg: var(--select-dark-option-selected-hover-bg, var(--select-option-selected-bg));
|
|
3804
3845
|
--select-option-selected-hover-color: var(--select-dark-option-selected-hover-color, var(--select-option-selected-color));
|
|
3846
|
+
--select-option-selected-hover-border: var(--select-dark-option-selected-hover-border, var(--select-option-selected-border, var(--select-option-hover-border, var(--select-option-border, none))));
|
|
3805
3847
|
}
|
|
3806
3848
|
|
|
3807
3849
|
:host(.dark-mode) .input-container,
|
|
@@ -3891,6 +3933,22 @@ class EnhancedSelect extends HTMLElement {
|
|
|
3891
3933
|
border-top-color: var(--select-border);
|
|
3892
3934
|
}
|
|
3893
3935
|
|
|
3936
|
+
:host(.dark-mode) .group-header,
|
|
3937
|
+
:host([dark-mode]) .group-header,
|
|
3938
|
+
:host([darkmode]) .group-header,
|
|
3939
|
+
:host([data-theme="dark"]) .group-header,
|
|
3940
|
+
:host([theme="dark"]) .group-header,
|
|
3941
|
+
:host-context(.dark-mode) .group-header,
|
|
3942
|
+
:host-context(.dark) .group-header,
|
|
3943
|
+
:host-context([dark-mode]) .group-header,
|
|
3944
|
+
:host-context([darkmode]) .group-header,
|
|
3945
|
+
:host-context([data-theme="dark"]) .group-header,
|
|
3946
|
+
:host-context([theme="dark"]) .group-header {
|
|
3947
|
+
background: var(--select-group-header-bg, #1a1a2e);
|
|
3948
|
+
border-bottom: var(--select-group-header-border-bottom, 1px solid rgba(255, 255, 255, 0.08));
|
|
3949
|
+
box-shadow: var(--select-group-header-shadow, 0 1px 2px rgba(0, 0, 0, 0.3));
|
|
3950
|
+
}
|
|
3951
|
+
|
|
3894
3952
|
:host(.dark-mode) .option.selected::before,
|
|
3895
3953
|
:host([dark-mode]) .option.selected::before,
|
|
3896
3954
|
:host([darkmode]) .option.selected::before,
|
|
@@ -4464,7 +4522,7 @@ class EnhancedSelect extends HTMLElement {
|
|
|
4464
4522
|
case 'End':
|
|
4465
4523
|
e.preventDefault();
|
|
4466
4524
|
if (this._state.isOpen) {
|
|
4467
|
-
const options =
|
|
4525
|
+
const options = this._getSelectableOptions();
|
|
4468
4526
|
const lastIndex = Math.max(0, options.length - 1);
|
|
4469
4527
|
this._setActive(lastIndex);
|
|
4470
4528
|
if (this._config.selection.mode === 'multi' && e.shiftKey) {
|
|
@@ -4485,8 +4543,12 @@ class EnhancedSelect extends HTMLElement {
|
|
|
4485
4543
|
}
|
|
4486
4544
|
break;
|
|
4487
4545
|
case 'Enter':
|
|
4546
|
+
case ' ':
|
|
4488
4547
|
e.preventDefault();
|
|
4489
|
-
if (this._state.
|
|
4548
|
+
if (!this._state.isOpen) {
|
|
4549
|
+
this._handleOpen();
|
|
4550
|
+
}
|
|
4551
|
+
else if (this._state.activeIndex >= 0) {
|
|
4490
4552
|
this._selectOption(this._state.activeIndex, { shiftKey: e.shiftKey, toggleKey: e.ctrlKey || e.metaKey });
|
|
4491
4553
|
}
|
|
4492
4554
|
break;
|
|
@@ -4515,7 +4577,7 @@ class EnhancedSelect extends HTMLElement {
|
|
|
4515
4577
|
}
|
|
4516
4578
|
}
|
|
4517
4579
|
_moveActive(delta, opts) {
|
|
4518
|
-
const options =
|
|
4580
|
+
const options = this._getSelectableOptions();
|
|
4519
4581
|
const next = Math.max(0, Math.min(options.length - 1, this._state.activeIndex + delta));
|
|
4520
4582
|
this._setActive(next);
|
|
4521
4583
|
if (this._config.selection.mode === 'multi' && opts?.shiftKey) {
|
|
@@ -4569,6 +4631,13 @@ class EnhancedSelect extends HTMLElement {
|
|
|
4569
4631
|
_getOptionElementByIndex(index) {
|
|
4570
4632
|
return this._optionsContainer.querySelector(`[data-index="${index}"]`);
|
|
4571
4633
|
}
|
|
4634
|
+
_getSelectableOptions() {
|
|
4635
|
+
// Filter out group headers and other non-selectable elements
|
|
4636
|
+
// Only return elements with data-index or data-sm-selectable attributes
|
|
4637
|
+
return Array.from(this._optionsContainer.children).filter((child) => {
|
|
4638
|
+
return child.hasAttribute('data-index') || child.hasAttribute('data-sm-selectable');
|
|
4639
|
+
});
|
|
4640
|
+
}
|
|
4572
4641
|
_buildRendererHelpers() {
|
|
4573
4642
|
return {
|
|
4574
4643
|
onSelect: (_item, index) => this._selectOption(index),
|
|
@@ -4603,7 +4672,7 @@ class EnhancedSelect extends HTMLElement {
|
|
|
4603
4672
|
_selectAll() {
|
|
4604
4673
|
if (this._config.selection.mode !== 'multi')
|
|
4605
4674
|
return;
|
|
4606
|
-
const options =
|
|
4675
|
+
const options = this._getSelectableOptions();
|
|
4607
4676
|
const maxSelections = this._config.selection.maxSelections || 0;
|
|
4608
4677
|
options.forEach((option, index) => {
|
|
4609
4678
|
if (maxSelections > 0 && this._state.selectedIndices.size >= maxSelections) {
|
|
@@ -4657,7 +4726,7 @@ class EnhancedSelect extends HTMLElement {
|
|
|
4657
4726
|
this._announce(`${this._state.selectedIndices.size} items selected`);
|
|
4658
4727
|
}
|
|
4659
4728
|
_setInitialActiveOption() {
|
|
4660
|
-
const options =
|
|
4729
|
+
const options = this._getSelectableOptions();
|
|
4661
4730
|
if (options.length === 0)
|
|
4662
4731
|
return;
|
|
4663
4732
|
const selected = Array.from(this._state.selectedIndices).sort((a, b) => a - b);
|