@smilodon/core 1.4.10 → 1.4.11
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 +28 -0
- package/dist/index.cjs +52 -26
- package/dist/index.cjs.map +1 -1
- package/dist/index.js +52 -26
- 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 +52 -26
- 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
|
@@ -610,6 +610,11 @@ Dark mode is **opt-in only** and can be enabled by adding a class or data attrib
|
|
|
610
610
|
|
|
611
611
|
<!-- Using data attribute -->
|
|
612
612
|
<enhanced-select data-theme="dark"></enhanced-select>
|
|
613
|
+
|
|
614
|
+
<!-- Also supported (attribute aliases) -->
|
|
615
|
+
<enhanced-select dark-mode></enhanced-select>
|
|
616
|
+
<enhanced-select darkmode></enhanced-select>
|
|
617
|
+
<enhanced-select theme="dark"></enhanced-select>
|
|
613
618
|
```
|
|
614
619
|
|
|
615
620
|
```css
|
|
@@ -631,6 +636,8 @@ enhanced-select.dark-mode {
|
|
|
631
636
|
**Light Mode (Default)**
|
|
632
637
|
```css
|
|
633
638
|
--select-options-bg /* Options container background (white) */
|
|
639
|
+
--select-width /* Host width (100% default) */
|
|
640
|
+
--select-height /* Host height (auto default) */
|
|
634
641
|
--select-option-color /* Option text color (#1f2937) */
|
|
635
642
|
--select-option-bg /* Option background (white) */
|
|
636
643
|
--select-option-padding /* Option padding (8px 12px) */
|
|
@@ -643,6 +650,8 @@ enhanced-select.dark-mode {
|
|
|
643
650
|
--select-option-selected-hover-border /* Selected+hover border (inherits selected border by default) */
|
|
644
651
|
--select-option-active-bg /* Active background (#f3f4f6) */
|
|
645
652
|
--select-option-active-color /* Active text color (#1f2937) */
|
|
653
|
+
--select-input-width /* Input field width */
|
|
654
|
+
--select-input-height /* Input container height */
|
|
646
655
|
--select-dropdown-bg /* Dropdown background (white) */
|
|
647
656
|
--select-dropdown-border /* Dropdown border color (#ccc) */
|
|
648
657
|
--select-dropdown-shadow /* Dropdown shadow */
|
|
@@ -665,9 +674,17 @@ enhanced-select.dark-mode {
|
|
|
665
674
|
--select-group-header-color /* Text color (#6b7280) */
|
|
666
675
|
--select-group-header-bg /* Background (#f3f4f6) */
|
|
667
676
|
--select-group-header-font-size
|
|
677
|
+
--select-group-header-text-align /* Header text alignment (left default) */
|
|
668
678
|
--select-group-header-text-transform
|
|
669
679
|
--select-group-header-letter-spacing
|
|
670
680
|
--select-group-header-border-bottom
|
|
681
|
+
|
|
682
|
+
/* Option content and checkmark hooks */
|
|
683
|
+
--select-option-content-overflow
|
|
684
|
+
--select-option-content-text-overflow
|
|
685
|
+
--select-option-content-white-space
|
|
686
|
+
--select-checkmark-margin-left
|
|
687
|
+
--select-checkmark-color
|
|
671
688
|
```
|
|
672
689
|
|
|
673
690
|
**Dark Mode (Opt-in)**
|
|
@@ -717,8 +734,19 @@ enhanced-select {
|
|
|
717
734
|
transparent 100%
|
|
718
735
|
);
|
|
719
736
|
}
|
|
737
|
+
|
|
738
|
+
/* Typo-compatible aliases are also accepted */
|
|
739
|
+
enhanced-select {
|
|
740
|
+
--select-seperator-width: 2px;
|
|
741
|
+
--select-seperator-height: 80%;
|
|
742
|
+
--select-seperator-position: 40px;
|
|
743
|
+
--select-seperator-gradient: linear-gradient(to bottom, transparent 0%, #3b82f6 20%, #3b82f6 80%, transparent 100%);
|
|
744
|
+
}
|
|
720
745
|
```
|
|
721
746
|
|
|
747
|
+
**Gradient Dropdown + Hover/Selected States**
|
|
748
|
+
If your dropdown uses a gradient background (for example via `--select-dropdown-bg`), option hover/selected colors still work as expected. The component intentionally uses the `background` shorthand for hover/selected option states so any inherited `background-image` layers are cleared correctly.
|
|
749
|
+
|
|
722
750
|
**Badge Remove/Delete Button (Multi-Select)**
|
|
723
751
|
The × button that removes selected items in multi-select mode is fully customizable:
|
|
724
752
|
|
package/dist/index.cjs
CHANGED
|
@@ -1534,6 +1534,8 @@ class SelectOption extends HTMLElement {
|
|
|
1534
1534
|
padding: var(--select-option-padding, 8px 12px);
|
|
1535
1535
|
cursor: pointer;
|
|
1536
1536
|
user-select: none;
|
|
1537
|
+
color: var(--select-option-color, var(--select-text-color, #1f2937));
|
|
1538
|
+
background: var(--select-option-bg, var(--select-dropdown-bg, var(--select-bg, white)));
|
|
1537
1539
|
transition: var(--select-option-transition, background-color 0.2s ease);
|
|
1538
1540
|
border: var(--select-option-border, none);
|
|
1539
1541
|
border-bottom: var(--select-option-border-bottom, none);
|
|
@@ -1578,9 +1580,20 @@ class SelectOption extends HTMLElement {
|
|
|
1578
1580
|
|
|
1579
1581
|
.option-content {
|
|
1580
1582
|
flex: 1;
|
|
1581
|
-
overflow: hidden;
|
|
1582
|
-
text-overflow: ellipsis;
|
|
1583
|
-
white-space: nowrap;
|
|
1583
|
+
overflow: var(--select-option-content-overflow, hidden);
|
|
1584
|
+
text-overflow: var(--select-option-content-text-overflow, ellipsis);
|
|
1585
|
+
white-space: var(--select-option-content-white-space, nowrap);
|
|
1586
|
+
}
|
|
1587
|
+
|
|
1588
|
+
.checkmark-icon {
|
|
1589
|
+
display: none;
|
|
1590
|
+
margin-left: var(--select-checkmark-margin-left, 8px);
|
|
1591
|
+
color: var(--select-checkmark-color, currentColor);
|
|
1592
|
+
}
|
|
1593
|
+
|
|
1594
|
+
:host([aria-selected="true"]) .checkmark-icon,
|
|
1595
|
+
.option-container.selected .checkmark-icon {
|
|
1596
|
+
display: inline-flex;
|
|
1584
1597
|
}
|
|
1585
1598
|
|
|
1586
1599
|
.remove-button {
|
|
@@ -1708,16 +1721,6 @@ class SelectOption extends HTMLElement {
|
|
|
1708
1721
|
<path d="M4 8.5L6.5 11L12 5.5" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"/>
|
|
1709
1722
|
</svg>
|
|
1710
1723
|
`;
|
|
1711
|
-
// Visibility control via CSS or inline style
|
|
1712
|
-
// We set it to display: none unless selected.
|
|
1713
|
-
// User can override this behavior via part styling if they want transitions
|
|
1714
|
-
if (!selected) {
|
|
1715
|
-
checkmark.style.display = 'none';
|
|
1716
|
-
}
|
|
1717
|
-
else {
|
|
1718
|
-
checkmark.style.marginLeft = '8px';
|
|
1719
|
-
checkmark.style.color = 'currentColor';
|
|
1720
|
-
}
|
|
1721
1724
|
this._container.appendChild(checkmark);
|
|
1722
1725
|
}
|
|
1723
1726
|
// Data Attributes Contract on Host
|
|
@@ -1955,7 +1958,6 @@ class EnhancedSelect extends HTMLElement {
|
|
|
1955
1958
|
// Angular's rendering seems to not apply :host styles correctly in some cases
|
|
1956
1959
|
// Must be done in connectedCallback when element is attached to DOM
|
|
1957
1960
|
this.style.display = 'block';
|
|
1958
|
-
this.style.width = '100%';
|
|
1959
1961
|
if (this._optionRenderer) {
|
|
1960
1962
|
this._setGlobalStylesMirroring(true);
|
|
1961
1963
|
}
|
|
@@ -2198,7 +2200,8 @@ class EnhancedSelect extends HTMLElement {
|
|
|
2198
2200
|
:host {
|
|
2199
2201
|
display: block;
|
|
2200
2202
|
position: relative;
|
|
2201
|
-
width: 100
|
|
2203
|
+
width: var(--select-width, 100%);
|
|
2204
|
+
height: var(--select-height, auto);
|
|
2202
2205
|
}
|
|
2203
2206
|
|
|
2204
2207
|
.select-container {
|
|
@@ -2214,6 +2217,7 @@ class EnhancedSelect extends HTMLElement {
|
|
|
2214
2217
|
flex-wrap: wrap;
|
|
2215
2218
|
gap: var(--select-input-gap, 6px);
|
|
2216
2219
|
padding: var(--select-input-padding, 6px 52px 6px 8px);
|
|
2220
|
+
height: var(--select-input-height, auto);
|
|
2217
2221
|
min-height: var(--select-input-min-height, 44px);
|
|
2218
2222
|
max-height: var(--select-input-max-height, 160px);
|
|
2219
2223
|
overflow-y: var(--select-input-overflow-y, auto);
|
|
@@ -2235,17 +2239,17 @@ class EnhancedSelect extends HTMLElement {
|
|
|
2235
2239
|
content: '';
|
|
2236
2240
|
position: absolute;
|
|
2237
2241
|
top: 50%;
|
|
2238
|
-
right: var(--select-separator-position, 40px);
|
|
2242
|
+
right: var(--select-separator-position, var(--select-seperator-position, 40px));
|
|
2239
2243
|
transform: translateY(-50%);
|
|
2240
|
-
width: var(--select-separator-width, 1px);
|
|
2241
|
-
height: var(--select-separator-height, 60%);
|
|
2242
|
-
background: var(--select-separator-bg, var(--select-separator-gradient, linear-gradient(
|
|
2244
|
+
width: var(--select-separator-width, var(--select-seperator-width, 1px));
|
|
2245
|
+
height: var(--select-separator-height, var(--select-seperator-height, 60%));
|
|
2246
|
+
background: var(--select-separator-bg, var(--select-seperator-bg, var(--select-separator-gradient, var(--select-seperator-gradient, linear-gradient(
|
|
2243
2247
|
to bottom,
|
|
2244
2248
|
transparent 0%,
|
|
2245
2249
|
rgba(0, 0, 0, 0.1) 20%,
|
|
2246
2250
|
rgba(0, 0, 0, 0.1) 80%,
|
|
2247
2251
|
transparent 100%
|
|
2248
|
-
)));
|
|
2252
|
+
))));
|
|
2249
2253
|
pointer-events: none;
|
|
2250
2254
|
z-index: 1;
|
|
2251
2255
|
}
|
|
@@ -2272,7 +2276,7 @@ class EnhancedSelect extends HTMLElement {
|
|
|
2272
2276
|
}
|
|
2273
2277
|
|
|
2274
2278
|
.input-container.has-clear-control::after {
|
|
2275
|
-
right: var(--select-separator-position-with-clear, 72px);
|
|
2279
|
+
right: var(--select-separator-position-with-clear, var(--select-seperator-position-with-clear, 72px));
|
|
2276
2280
|
}
|
|
2277
2281
|
|
|
2278
2282
|
.dropdown-arrow-container.with-clear-control {
|
|
@@ -2350,6 +2354,7 @@ class EnhancedSelect extends HTMLElement {
|
|
|
2350
2354
|
|
|
2351
2355
|
.select-input {
|
|
2352
2356
|
flex: 1;
|
|
2357
|
+
width: var(--select-input-width, auto);
|
|
2353
2358
|
min-width: var(--select-input-min-width, 120px);
|
|
2354
2359
|
padding: var(--select-input-field-padding, 4px);
|
|
2355
2360
|
border: none;
|
|
@@ -2444,6 +2449,7 @@ class EnhancedSelect extends HTMLElement {
|
|
|
2444
2449
|
font-weight: var(--select-group-header-weight, 600);
|
|
2445
2450
|
color: var(--select-group-header-color, #6b7280);
|
|
2446
2451
|
background-color: var(--select-group-header-bg, #f3f4f6);
|
|
2452
|
+
text-align: var(--select-group-header-text-align, left);
|
|
2447
2453
|
font-size: var(--select-group-header-font-size, 12px);
|
|
2448
2454
|
text-transform: var(--select-group-header-text-transform, uppercase);
|
|
2449
2455
|
letter-spacing: var(--select-group-header-letter-spacing, 0.05em);
|
|
@@ -2628,10 +2634,25 @@ class EnhancedSelect extends HTMLElement {
|
|
|
2628
2634
|
|
|
2629
2635
|
/* Dark mode - Opt-in via class, data attribute, or ancestor context */
|
|
2630
2636
|
:host(.dark-mode),
|
|
2637
|
+
:host([dark-mode]),
|
|
2638
|
+
:host([darkmode]),
|
|
2631
2639
|
:host([data-theme="dark"]),
|
|
2640
|
+
:host([theme="dark"]),
|
|
2632
2641
|
:host-context(.dark-mode),
|
|
2633
2642
|
:host-context(.dark),
|
|
2634
|
-
:host-context([
|
|
2643
|
+
:host-context([dark-mode]),
|
|
2644
|
+
:host-context([darkmode]),
|
|
2645
|
+
:host-context([data-theme="dark"]),
|
|
2646
|
+
:host-context([theme="dark"]) {
|
|
2647
|
+
/* map dark tokens to base option tokens so nested <select-option>
|
|
2648
|
+
components also pick up dark mode via inherited CSS variables */
|
|
2649
|
+
--select-option-bg: var(--select-dark-option-bg, #1f2937);
|
|
2650
|
+
--select-option-color: var(--select-dark-option-color, #f9fafb);
|
|
2651
|
+
--select-option-hover-bg: var(--select-dark-option-hover-bg, #374151);
|
|
2652
|
+
--select-option-hover-color: var(--select-dark-option-hover-color, #f9fafb);
|
|
2653
|
+
--select-option-selected-bg: var(--select-dark-option-selected-bg, #3730a3);
|
|
2654
|
+
--select-option-selected-color: var(--select-dark-option-selected-text, #e0e7ff);
|
|
2655
|
+
|
|
2635
2656
|
.input-container {
|
|
2636
2657
|
background: var(--select-dark-bg, #1f2937);
|
|
2637
2658
|
border-color: var(--select-dark-border, #4b5563);
|
|
@@ -2684,6 +2705,8 @@ class EnhancedSelect extends HTMLElement {
|
|
|
2684
2705
|
|
|
2685
2706
|
.option.active:not(.selected) {
|
|
2686
2707
|
background-color: var(--select-dark-option-active-bg, #374151);
|
|
2708
|
+
color: var(--select-dark-option-active-color, #f9fafb);
|
|
2709
|
+
outline: var(--select-dark-option-active-outline, 2px solid rgba(129, 140, 248, 0.55));
|
|
2687
2710
|
}
|
|
2688
2711
|
|
|
2689
2712
|
/* Group header in dark mode */
|
|
@@ -2691,9 +2714,6 @@ class EnhancedSelect extends HTMLElement {
|
|
|
2691
2714
|
color: var(--select-dark-group-header-color, var(--select-group-header-color, #6b7280));
|
|
2692
2715
|
background-color: var(--select-dark-group-header-bg, var(--select-group-header-bg, #374151));
|
|
2693
2716
|
}
|
|
2694
|
-
color: var(--select-dark-option-active-color, #f9fafb);
|
|
2695
|
-
outline: var(--select-dark-option-active-outline, 2px solid rgba(129, 140, 248, 0.55));
|
|
2696
|
-
}
|
|
2697
2717
|
|
|
2698
2718
|
.option.selected.active {
|
|
2699
2719
|
background-color: var(--select-dark-option-selected-active-bg, var(--select-dark-option-selected-bg, #3730a3));
|
|
@@ -2815,7 +2835,13 @@ class EnhancedSelect extends HTMLElement {
|
|
|
2815
2835
|
this._handleOpen();
|
|
2816
2836
|
}
|
|
2817
2837
|
else {
|
|
2818
|
-
//
|
|
2838
|
+
// Keep open while interacting directly with the input so users can
|
|
2839
|
+
// place cursor/type without accidental collapse.
|
|
2840
|
+
if (target === this._input) {
|
|
2841
|
+
this._input.focus();
|
|
2842
|
+
return;
|
|
2843
|
+
}
|
|
2844
|
+
// clicking other parts of the input container while open toggles close
|
|
2819
2845
|
this._handleClose();
|
|
2820
2846
|
}
|
|
2821
2847
|
// Focus the input (do not prevent default behavior)
|