@smilodon/core 1.5.0 → 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 +113 -0
- package/dist/index.cjs +70 -12
- package/dist/index.cjs.map +1 -1
- package/dist/index.js +70 -12
- 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 +70 -12
- 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/README.md
CHANGED
|
@@ -128,6 +128,8 @@ See the [main documentation](https://github.com/navidrezadoost/smilodon#readme)
|
|
|
128
128
|
- **Zero Dependencies**: 6.6 KB gzipped runtime
|
|
129
129
|
- **Framework Agnostic**: Works with React, Vue, Svelte, or vanilla JS
|
|
130
130
|
- **Accessibility**: WCAG 2.2 AA compliant with ARIA 1.2
|
|
131
|
+
- **Full keyboard navigation**: Enter/Space, Arrows, Home/End, PageUp/Down, Escape
|
|
132
|
+
- **Multi-select modes**: wrap, horizontal, vertical, both (with drag-scroll)
|
|
131
133
|
|
|
132
134
|
### 🔒 Enterprise Grade
|
|
133
135
|
- **SOC2 Compliant**: Audit-ready security controls
|
|
@@ -701,6 +703,117 @@ enhanced-select.dark-mode {
|
|
|
701
703
|
--select-dark-option-selected-bg /* Dark selected bg (#3730a3) */
|
|
702
704
|
--select-dark-group-header-color /* Dark header text */
|
|
703
705
|
--select-dark-group-header-bg /* Dark header background */
|
|
706
|
+
--select-dark-badge-bg /* Dark badge background */
|
|
707
|
+
--select-dark-badge-color /* Dark badge text */
|
|
708
|
+
--select-dark-arrow-color /* Dark arrow icon color */
|
|
709
|
+
--select-dark-arrow-bg /* Dark arrow background */
|
|
710
|
+
--select-dark-arrow-hover-bg /* Dark arrow hover background */
|
|
711
|
+
--select-dark-separator-bg /* Dark separator color */
|
|
712
|
+
--select-dark-separator-width /* Dark separator width */
|
|
713
|
+
--select-dark-empty-color /* Dark empty state text */
|
|
714
|
+
```
|
|
715
|
+
|
|
716
|
+
---
|
|
717
|
+
|
|
718
|
+
### Keyboard Navigation & Accessibility
|
|
719
|
+
|
|
720
|
+
Smilodon provides full keyboard accessibility (WCAG 2.2 AA compliant):
|
|
721
|
+
|
|
722
|
+
| Key | Action |
|
|
723
|
+
|-----|--------|
|
|
724
|
+
| `Enter` / `Space` | Open dropdown or select focused option |
|
|
725
|
+
| `↑` / `↓` | Navigate through options |
|
|
726
|
+
| `Home` / `End` | Jump to first/last option |
|
|
727
|
+
| `PageUp` / `PageDown` | Jump 10 options up/down |
|
|
728
|
+
| `Escape` | Close dropdown |
|
|
729
|
+
| `Tab` | Close dropdown and move focus |
|
|
730
|
+
| `Ctrl+A` (multi-select) | Select all options |
|
|
731
|
+
| Type characters | Type-ahead search |
|
|
732
|
+
|
|
733
|
+
**Multi-Select Range Selection:**
|
|
734
|
+
- `Shift + ↑/↓` - Range selection
|
|
735
|
+
- `Ctrl/Cmd + Click` - Toggle individual items
|
|
736
|
+
- `Shift + Home/End` - Select from current to first/last
|
|
737
|
+
|
|
738
|
+
---
|
|
739
|
+
|
|
740
|
+
### Multi-Select Display Modes
|
|
741
|
+
|
|
742
|
+
Control badge scrolling behavior in multi-select mode with `multiSelectDisplay` config:
|
|
743
|
+
|
|
744
|
+
```javascript
|
|
745
|
+
{
|
|
746
|
+
multiSelectDisplay: {
|
|
747
|
+
mode: 'wrap', // 'wrap' | 'horizontal' | 'vertical' | 'both'
|
|
748
|
+
maxHeight: '160px',
|
|
749
|
+
overflowX: 'auto',
|
|
750
|
+
overflowY: 'auto',
|
|
751
|
+
dragScroll: true // Enable drag-to-scroll (horizontal mode)
|
|
752
|
+
}
|
|
753
|
+
}
|
|
754
|
+
```
|
|
755
|
+
|
|
756
|
+
**Display Modes:**
|
|
757
|
+
- **`wrap`** (default) - Badges wrap to new lines, vertical scroll when needed
|
|
758
|
+
- **`horizontal`** - Single row, horizontal scroll, drag-to-scroll enabled
|
|
759
|
+
- **`vertical`** - Single column, vertical scroll only
|
|
760
|
+
- **`both`** - Both horizontal and vertical scroll, dense packing
|
|
761
|
+
|
|
762
|
+
---
|
|
763
|
+
|
|
764
|
+
### Advanced Styling Controls
|
|
765
|
+
|
|
766
|
+
#### Disabling Hover Animation
|
|
767
|
+
|
|
768
|
+
To remove hover effects on options:
|
|
769
|
+
|
|
770
|
+
```css
|
|
771
|
+
enhanced-select {
|
|
772
|
+
--select-option-hover-bg: transparent;
|
|
773
|
+
--select-option-hover-color: inherit;
|
|
774
|
+
--select-option-hover-transform: none;
|
|
775
|
+
}
|
|
776
|
+
```
|
|
777
|
+
|
|
778
|
+
#### Multi-Select Container & Badge Padding
|
|
779
|
+
|
|
780
|
+
Control container padding separately from badge padding:
|
|
781
|
+
|
|
782
|
+
```css
|
|
783
|
+
enhanced-select {
|
|
784
|
+
--select-multi-container-padding: 8px; /* Container internal padding */
|
|
785
|
+
--select-badge-padding: 4px 8px; /* Individual badge padding */
|
|
786
|
+
--select-input-gap: 6px; /* Gap between badges */
|
|
787
|
+
}
|
|
788
|
+
```
|
|
789
|
+
|
|
790
|
+
#### Separator Dimension Controls
|
|
791
|
+
|
|
792
|
+
Full control over the vertical separator line (works in all modes):
|
|
793
|
+
|
|
794
|
+
```css
|
|
795
|
+
enhanced-select {
|
|
796
|
+
--select-separator-width: 2px; /* Line thickness */
|
|
797
|
+
--select-separator-height: 60%; /* Line height (% of container) */
|
|
798
|
+
--select-separator-display: none; /* Hide separator completely */
|
|
799
|
+
--select-separator-bg: #e5e7eb; /* Custom color/gradient */
|
|
800
|
+
--select-separator-opacity: 0.8; /* Line opacity */
|
|
801
|
+
}
|
|
802
|
+
```
|
|
803
|
+
|
|
804
|
+
#### Input & Badge Typography
|
|
805
|
+
|
|
806
|
+
```css
|
|
807
|
+
enhanced-select {
|
|
808
|
+
/* Input field text */
|
|
809
|
+
--select-input-font-size: 14px;
|
|
810
|
+
--select-input-font-weight: 400;
|
|
811
|
+
|
|
812
|
+
/* Badge text */
|
|
813
|
+
--select-badge-font-size: 13px;
|
|
814
|
+
--select-badge-font-weight: 500;
|
|
815
|
+
--select-badge-line-height: 1.2;
|
|
816
|
+
}
|
|
704
817
|
```
|
|
705
818
|
|
|
706
819
|
**Complete CSS Variables Reference**
|
package/dist/index.cjs
CHANGED
|
@@ -2771,8 +2771,14 @@ class EnhancedSelect extends HTMLElement {
|
|
|
2771
2771
|
--select-multi-separator-inset-block: 10px;
|
|
2772
2772
|
--select-multi-action-surface-bg: var(--select-input-bg, var(--select-surface));
|
|
2773
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;
|
|
2774
2777
|
--select-separator-opacity: 0.6;
|
|
2775
2778
|
--select-separator-active-opacity: 1;
|
|
2779
|
+
--select-separator-width: 1px;
|
|
2780
|
+
--select-separator-height: 50%;
|
|
2781
|
+
--select-separator-display: block;
|
|
2776
2782
|
--select-separator-position: var(--select-arrow-width, 42px);
|
|
2777
2783
|
--select-separator-position-with-clear: calc(var(--select-arrow-right-with-clear, 34px) + var(--select-arrow-width, 42px));
|
|
2778
2784
|
--select-separator-dark-bg: linear-gradient(
|
|
@@ -2801,9 +2807,16 @@ class EnhancedSelect extends HTMLElement {
|
|
|
2801
2807
|
--select-dropdown-transform-origin: top center;
|
|
2802
2808
|
--select-scrollbar-width: 6px;
|
|
2803
2809
|
--select-scrollbar-thumb-radius: 3px;
|
|
2810
|
+
--select-option-hover-enabled: 1;
|
|
2804
2811
|
--select-option-hover-transform: translateX(2px);
|
|
2805
2812
|
--select-option-font-weight: 450;
|
|
2806
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;
|
|
2807
2820
|
--select-option-disabled-opacity: 0.5;
|
|
2808
2821
|
--select-option-disabled-cursor: not-allowed;
|
|
2809
2822
|
--select-option-active-outline-offset: -2px;
|
|
@@ -3040,9 +3053,13 @@ class EnhancedSelect extends HTMLElement {
|
|
|
3040
3053
|
min-height: var(--select-input-min-height, 48px);
|
|
3041
3054
|
max-height: var(--select-input-max-height, 160px);
|
|
3042
3055
|
overflow: hidden;
|
|
3056
|
+
padding: var(--select-multi-container-padding, 6px);
|
|
3043
3057
|
align-content: var(--select-input-align-content, center);
|
|
3044
3058
|
text-align: var(--select-input-text-align, start);
|
|
3045
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);
|
|
3046
3063
|
border: var(--select-input-border, 1.5px solid var(--select-border));
|
|
3047
3064
|
border-radius: var(--select-input-border-radius, var(--select-radius-md));
|
|
3048
3065
|
box-shadow: var(--select-shadow-sm);
|
|
@@ -3162,6 +3179,7 @@ class EnhancedSelect extends HTMLElement {
|
|
|
3162
3179
|
/* Elegant separator line before arrow */
|
|
3163
3180
|
.input-container::after {
|
|
3164
3181
|
content: '';
|
|
3182
|
+
display: var(--select-separator-display, block);
|
|
3165
3183
|
position: absolute;
|
|
3166
3184
|
top: 50%;
|
|
3167
3185
|
right: var(--select-separator-position, var(--select-arrow-width, 42px));
|
|
@@ -3478,22 +3496,26 @@ class EnhancedSelect extends HTMLElement {
|
|
|
3478
3496
|
───────────────────────────────────────────────────────────────────────── */
|
|
3479
3497
|
|
|
3480
3498
|
.group-header {
|
|
3481
|
-
padding: var(--select-group-header-padding, 10px 12px
|
|
3482
|
-
margin: var(--select-group-header-margin, 0);
|
|
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));
|
|
3483
3501
|
font-weight: var(--select-group-header-weight, 600);
|
|
3484
3502
|
color: var(--select-group-header-color, var(--select-text-muted));
|
|
3485
|
-
background
|
|
3503
|
+
background: var(--select-group-header-bg, #ffffff);
|
|
3486
3504
|
text-align: var(--select-group-header-text-align, left);
|
|
3487
3505
|
font-size: var(--select-group-header-font-size, 0.7333em);
|
|
3488
3506
|
text-transform: var(--select-group-header-text-transform, uppercase);
|
|
3489
3507
|
letter-spacing: var(--select-group-header-letter-spacing, 0.08em);
|
|
3490
3508
|
position: sticky;
|
|
3491
|
-
top:
|
|
3492
|
-
|
|
3509
|
+
top: calc(var(--select-options-padding, 6px) * -1);
|
|
3510
|
+
left: 0;
|
|
3511
|
+
right: 0;
|
|
3512
|
+
z-index: 100;
|
|
3493
3513
|
border: var(--select-group-header-border, none);
|
|
3494
|
-
border-bottom: var(--select-group-header-border-bottom,
|
|
3514
|
+
border-bottom: var(--select-group-header-border-bottom, 1px solid rgba(0, 0, 0, 0.08));
|
|
3495
3515
|
border-radius: var(--select-group-header-border-radius, 0);
|
|
3496
|
-
box-shadow: var(--select-group-header-shadow,
|
|
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;
|
|
3497
3519
|
}
|
|
3498
3520
|
|
|
3499
3521
|
.group-header:not(:first-child) {
|
|
@@ -3529,10 +3551,10 @@ class EnhancedSelect extends HTMLElement {
|
|
|
3529
3551
|
}
|
|
3530
3552
|
|
|
3531
3553
|
.option:hover {
|
|
3532
|
-
background: var(--select-option-hover-bg, var(--select-surface-elevated));
|
|
3533
|
-
border: var(--select-option-hover-border, var(--select-option-border, none));
|
|
3534
|
-
color: var(--select-option-hover-color, var(--select-text));
|
|
3535
|
-
transform: var(--select-option-hover-transform);
|
|
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;
|
|
3536
3558
|
}
|
|
3537
3559
|
|
|
3538
3560
|
.option.selected {
|
|
@@ -3796,6 +3818,22 @@ class EnhancedSelect extends HTMLElement {
|
|
|
3796
3818
|
|
|
3797
3819
|
--select-dropdown-bg: var(--select-dark-dropdown-bg, var(--select-surface));
|
|
3798
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);
|
|
3828
|
+
|
|
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
|
+
|
|
3799
3837
|
--select-option-bg: var(--select-dark-option-bg, transparent);
|
|
3800
3838
|
--select-option-color: var(--select-dark-option-color, var(--select-text));
|
|
3801
3839
|
--select-option-hover-bg: var(--select-dark-option-hover-bg, var(--select-surface-elevated));
|
|
@@ -3893,6 +3931,22 @@ class EnhancedSelect extends HTMLElement {
|
|
|
3893
3931
|
border-top-color: var(--select-border);
|
|
3894
3932
|
}
|
|
3895
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
|
+
|
|
3896
3950
|
:host(.dark-mode) .option.selected::before,
|
|
3897
3951
|
:host([dark-mode]) .option.selected::before,
|
|
3898
3952
|
:host([darkmode]) .option.selected::before,
|
|
@@ -4487,8 +4541,12 @@ class EnhancedSelect extends HTMLElement {
|
|
|
4487
4541
|
}
|
|
4488
4542
|
break;
|
|
4489
4543
|
case 'Enter':
|
|
4544
|
+
case ' ':
|
|
4490
4545
|
e.preventDefault();
|
|
4491
|
-
if (this._state.
|
|
4546
|
+
if (!this._state.isOpen) {
|
|
4547
|
+
this._handleOpen();
|
|
4548
|
+
}
|
|
4549
|
+
else if (this._state.activeIndex >= 0) {
|
|
4492
4550
|
this._selectOption(this._state.activeIndex, { shiftKey: e.shiftKey, toggleKey: e.ctrlKey || e.metaKey });
|
|
4493
4551
|
}
|
|
4494
4552
|
break;
|