@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/dist/index.js CHANGED
@@ -1532,6 +1532,8 @@ class SelectOption extends HTMLElement {
1532
1532
  padding: var(--select-option-padding, 8px 12px);
1533
1533
  cursor: pointer;
1534
1534
  user-select: none;
1535
+ color: var(--select-option-color, var(--select-text-color, #1f2937));
1536
+ background: var(--select-option-bg, var(--select-dropdown-bg, var(--select-bg, white)));
1535
1537
  transition: var(--select-option-transition, background-color 0.2s ease);
1536
1538
  border: var(--select-option-border, none);
1537
1539
  border-bottom: var(--select-option-border-bottom, none);
@@ -1576,9 +1578,20 @@ class SelectOption extends HTMLElement {
1576
1578
 
1577
1579
  .option-content {
1578
1580
  flex: 1;
1579
- overflow: hidden;
1580
- text-overflow: ellipsis;
1581
- white-space: nowrap;
1581
+ overflow: var(--select-option-content-overflow, hidden);
1582
+ text-overflow: var(--select-option-content-text-overflow, ellipsis);
1583
+ white-space: var(--select-option-content-white-space, nowrap);
1584
+ }
1585
+
1586
+ .checkmark-icon {
1587
+ display: none;
1588
+ margin-left: var(--select-checkmark-margin-left, 8px);
1589
+ color: var(--select-checkmark-color, currentColor);
1590
+ }
1591
+
1592
+ :host([aria-selected="true"]) .checkmark-icon,
1593
+ .option-container.selected .checkmark-icon {
1594
+ display: inline-flex;
1582
1595
  }
1583
1596
 
1584
1597
  .remove-button {
@@ -1706,16 +1719,6 @@ class SelectOption extends HTMLElement {
1706
1719
  <path d="M4 8.5L6.5 11L12 5.5" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"/>
1707
1720
  </svg>
1708
1721
  `;
1709
- // Visibility control via CSS or inline style
1710
- // We set it to display: none unless selected.
1711
- // User can override this behavior via part styling if they want transitions
1712
- if (!selected) {
1713
- checkmark.style.display = 'none';
1714
- }
1715
- else {
1716
- checkmark.style.marginLeft = '8px';
1717
- checkmark.style.color = 'currentColor';
1718
- }
1719
1722
  this._container.appendChild(checkmark);
1720
1723
  }
1721
1724
  // Data Attributes Contract on Host
@@ -1953,7 +1956,6 @@ class EnhancedSelect extends HTMLElement {
1953
1956
  // Angular's rendering seems to not apply :host styles correctly in some cases
1954
1957
  // Must be done in connectedCallback when element is attached to DOM
1955
1958
  this.style.display = 'block';
1956
- this.style.width = '100%';
1957
1959
  if (this._optionRenderer) {
1958
1960
  this._setGlobalStylesMirroring(true);
1959
1961
  }
@@ -2196,7 +2198,8 @@ class EnhancedSelect extends HTMLElement {
2196
2198
  :host {
2197
2199
  display: block;
2198
2200
  position: relative;
2199
- width: 100%;
2201
+ width: var(--select-width, 100%);
2202
+ height: var(--select-height, auto);
2200
2203
  }
2201
2204
 
2202
2205
  .select-container {
@@ -2212,6 +2215,7 @@ class EnhancedSelect extends HTMLElement {
2212
2215
  flex-wrap: wrap;
2213
2216
  gap: var(--select-input-gap, 6px);
2214
2217
  padding: var(--select-input-padding, 6px 52px 6px 8px);
2218
+ height: var(--select-input-height, auto);
2215
2219
  min-height: var(--select-input-min-height, 44px);
2216
2220
  max-height: var(--select-input-max-height, 160px);
2217
2221
  overflow-y: var(--select-input-overflow-y, auto);
@@ -2233,17 +2237,17 @@ class EnhancedSelect extends HTMLElement {
2233
2237
  content: '';
2234
2238
  position: absolute;
2235
2239
  top: 50%;
2236
- right: var(--select-separator-position, 40px);
2240
+ right: var(--select-separator-position, var(--select-seperator-position, 40px));
2237
2241
  transform: translateY(-50%);
2238
- width: var(--select-separator-width, 1px);
2239
- height: var(--select-separator-height, 60%);
2240
- background: var(--select-separator-bg, var(--select-separator-gradient, linear-gradient(
2242
+ width: var(--select-separator-width, var(--select-seperator-width, 1px));
2243
+ height: var(--select-separator-height, var(--select-seperator-height, 60%));
2244
+ background: var(--select-separator-bg, var(--select-seperator-bg, var(--select-separator-gradient, var(--select-seperator-gradient, linear-gradient(
2241
2245
  to bottom,
2242
2246
  transparent 0%,
2243
2247
  rgba(0, 0, 0, 0.1) 20%,
2244
2248
  rgba(0, 0, 0, 0.1) 80%,
2245
2249
  transparent 100%
2246
- )));
2250
+ ))));
2247
2251
  pointer-events: none;
2248
2252
  z-index: 1;
2249
2253
  }
@@ -2270,7 +2274,7 @@ class EnhancedSelect extends HTMLElement {
2270
2274
  }
2271
2275
 
2272
2276
  .input-container.has-clear-control::after {
2273
- right: var(--select-separator-position-with-clear, 72px);
2277
+ right: var(--select-separator-position-with-clear, var(--select-seperator-position-with-clear, 72px));
2274
2278
  }
2275
2279
 
2276
2280
  .dropdown-arrow-container.with-clear-control {
@@ -2348,6 +2352,7 @@ class EnhancedSelect extends HTMLElement {
2348
2352
 
2349
2353
  .select-input {
2350
2354
  flex: 1;
2355
+ width: var(--select-input-width, auto);
2351
2356
  min-width: var(--select-input-min-width, 120px);
2352
2357
  padding: var(--select-input-field-padding, 4px);
2353
2358
  border: none;
@@ -2442,6 +2447,7 @@ class EnhancedSelect extends HTMLElement {
2442
2447
  font-weight: var(--select-group-header-weight, 600);
2443
2448
  color: var(--select-group-header-color, #6b7280);
2444
2449
  background-color: var(--select-group-header-bg, #f3f4f6);
2450
+ text-align: var(--select-group-header-text-align, left);
2445
2451
  font-size: var(--select-group-header-font-size, 12px);
2446
2452
  text-transform: var(--select-group-header-text-transform, uppercase);
2447
2453
  letter-spacing: var(--select-group-header-letter-spacing, 0.05em);
@@ -2626,10 +2632,25 @@ class EnhancedSelect extends HTMLElement {
2626
2632
 
2627
2633
  /* Dark mode - Opt-in via class, data attribute, or ancestor context */
2628
2634
  :host(.dark-mode),
2635
+ :host([dark-mode]),
2636
+ :host([darkmode]),
2629
2637
  :host([data-theme="dark"]),
2638
+ :host([theme="dark"]),
2630
2639
  :host-context(.dark-mode),
2631
2640
  :host-context(.dark),
2632
- :host-context([data-theme="dark"]) {
2641
+ :host-context([dark-mode]),
2642
+ :host-context([darkmode]),
2643
+ :host-context([data-theme="dark"]),
2644
+ :host-context([theme="dark"]) {
2645
+ /* map dark tokens to base option tokens so nested <select-option>
2646
+ components also pick up dark mode via inherited CSS variables */
2647
+ --select-option-bg: var(--select-dark-option-bg, #1f2937);
2648
+ --select-option-color: var(--select-dark-option-color, #f9fafb);
2649
+ --select-option-hover-bg: var(--select-dark-option-hover-bg, #374151);
2650
+ --select-option-hover-color: var(--select-dark-option-hover-color, #f9fafb);
2651
+ --select-option-selected-bg: var(--select-dark-option-selected-bg, #3730a3);
2652
+ --select-option-selected-color: var(--select-dark-option-selected-text, #e0e7ff);
2653
+
2633
2654
  .input-container {
2634
2655
  background: var(--select-dark-bg, #1f2937);
2635
2656
  border-color: var(--select-dark-border, #4b5563);
@@ -2682,6 +2703,8 @@ class EnhancedSelect extends HTMLElement {
2682
2703
 
2683
2704
  .option.active:not(.selected) {
2684
2705
  background-color: var(--select-dark-option-active-bg, #374151);
2706
+ color: var(--select-dark-option-active-color, #f9fafb);
2707
+ outline: var(--select-dark-option-active-outline, 2px solid rgba(129, 140, 248, 0.55));
2685
2708
  }
2686
2709
 
2687
2710
  /* Group header in dark mode */
@@ -2689,9 +2712,6 @@ class EnhancedSelect extends HTMLElement {
2689
2712
  color: var(--select-dark-group-header-color, var(--select-group-header-color, #6b7280));
2690
2713
  background-color: var(--select-dark-group-header-bg, var(--select-group-header-bg, #374151));
2691
2714
  }
2692
- color: var(--select-dark-option-active-color, #f9fafb);
2693
- outline: var(--select-dark-option-active-outline, 2px solid rgba(129, 140, 248, 0.55));
2694
- }
2695
2715
 
2696
2716
  .option.selected.active {
2697
2717
  background-color: var(--select-dark-option-selected-active-bg, var(--select-dark-option-selected-bg, #3730a3));
@@ -2813,7 +2833,13 @@ class EnhancedSelect extends HTMLElement {
2813
2833
  this._handleOpen();
2814
2834
  }
2815
2835
  else {
2816
- // clicking the input while open should close the dropdown too
2836
+ // Keep open while interacting directly with the input so users can
2837
+ // place cursor/type without accidental collapse.
2838
+ if (target === this._input) {
2839
+ this._input.focus();
2840
+ return;
2841
+ }
2842
+ // clicking other parts of the input container while open toggles close
2817
2843
  this._handleClose();
2818
2844
  }
2819
2845
  // Focus the input (do not prevent default behavior)