@smilodon/core 1.19.0 → 1.21.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 +104 -5
- package/dist/index.cjs +1539 -189
- package/dist/index.cjs.map +1 -1
- package/dist/index.js +1537 -190
- 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 +1539 -189
- 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 +72 -1
- package/dist/types/src/config/global-config.d.ts +21 -3
- package/dist/types/src/config/public-config.d.ts +21 -0
- package/dist/types/src/data-loading/public-types.d.ts +4 -2
- package/dist/types/src/index.d.ts +2 -0
- package/dist/types/src/native-types.d.ts +1 -1
- package/dist/types/src/utils/selected-options-projection.d.ts +18 -0
- package/dist/types/src/utils/selected-target-resolver.d.ts +2 -0
- package/dist/types/src/utils/visual-navigation.d.ts +15 -0
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -14,7 +14,24 @@
|
|
|
14
14
|
|
|
15
15
|
> **Issue #100:** `multiSelectDisplay.scrollToLatestChip` is available in `@smilodon/core@1.17.0`. See [Multi-Select Display Modes](#multi-select-display-modes) and the [release verification](../../docs/releases/WEB-1.17.0-REGISTRY-VERIFICATION.json).
|
|
16
16
|
|
|
17
|
-
> **
|
|
17
|
+
> **Core 1.20.0:** Adds selected-first option presentation and selected-option open positioning through `selectedOptions` and `scrollToSelected`. It also includes Core 1.19.0's styling fixes and search threshold. See [selected-option configuration](#selected-option-presentation-and-opening-scroll), [arrow container positioning](#custom-arrow-slot), and the [release record](../../docs/releases/WEB-1.20.0-RELEASE.md).
|
|
18
|
+
|
|
19
|
+
## Selected-option presentation and opening scroll
|
|
20
|
+
|
|
21
|
+
The opt-in `selectedOptions.placement: 'selected-first'` setting stably promotes selected options for each dropdown opening. Grouped options remain within their original groups. `scrollToSelected` controls whether the selected target is preserved, revealed, or aligned when opening; the defaults remain original option order and the existing reveal behavior. Both settings are available through `updateConfig()` and accept partial nested updates that preserve sibling values. See the [selected-options projection and adapter qualification record](../../docs/architecture/SELECTED-OPTIONS-PROJECTION.md) for lifecycle, keyboard, virtualization, and qualification boundaries.
|
|
22
|
+
|
|
23
|
+
This configuration is available in `@smilodon/core@1.20.0`. The release browser and native-platform limits are recorded in the [release qualification](../../docs/releases/WEB-1.20.0-RELEASE.md).
|
|
24
|
+
|
|
25
|
+
```ts
|
|
26
|
+
select.updateConfig({
|
|
27
|
+
selectedOptions: { placement: 'selected-first' },
|
|
28
|
+
scrollToSelected: { onOpen: 'align', block: 'center' },
|
|
29
|
+
})
|
|
30
|
+
```
|
|
31
|
+
|
|
32
|
+
## Selected-label tooltip
|
|
33
|
+
|
|
34
|
+
Core displays the full selected display label in a shared tooltip when the closed single-select value or a multi-select chip is visually truncated. The tooltip appears on pointer hover or keyboard focus; a label that fits does not open one. It uses the same configured item-label resolver as the visible selection, so custom `serverSide.getLabelFromItem` labels are reflected. Search queries are not treated as selected values. Multi-select chip labels become tab stops only while truncated, and Escape dismisses the tooltip without moving focus. This behavior covers selected values and chips, not custom option content in the dropdown.
|
|
18
35
|
|
|
19
36
|
## Custom busy bucket (Core 1.13.0)
|
|
20
37
|
|
|
@@ -47,9 +64,9 @@ select.updateConfig({
|
|
|
47
64
|
|
|
48
65
|
The bucket exposes `::part(loading)`, `::part(loading-icon)`, `::part(loading-spinner)`, `::part(loading-message)`, and `::part(loading-content)`. Layout can be adjusted with `--select-busy-gap`, `--select-busy-padding`, `--select-busy-color`, `--select-busy-bg`, and the existing `--select-spinner-size` token. `minDisplayTime` is a visual minimum after request completion; it does not delay acceptance, pagination, or `aria-busy` updates.
|
|
49
66
|
|
|
50
|
-
## Acknowledged data loading
|
|
67
|
+
## Acknowledged data loading
|
|
51
68
|
|
|
52
|
-
The
|
|
69
|
+
The acknowledged protocol provides per-instance data-loading configuration and request completion on `EnhancedSelect`. It is included in the published Core package; the legacy protocol remains the default. Remote and hybrid search or cursor pagination require explicit acknowledged-protocol opt-in. There is no global acknowledged-loading default. See the [Core 1.19.0 release record](../../docs/releases/WEB-1.19.0-RELEASE.md) for the tested scope and browser limitations.
|
|
53
70
|
|
|
54
71
|
The host owns transport, cancellation, and retry decisions. `completeDataRequest()` accepts a response only when its request identity and query generation are current. A return value of `accepted` means the canonical response was accepted; DOM projection completes separately and is reported by `dataProjection`.
|
|
55
72
|
|
|
@@ -72,7 +89,7 @@ The default is `0`, which preserves existing behavior. The threshold applies to
|
|
|
72
89
|
|
|
73
90
|
Below the threshold, the current text remains visible while Core displays the unfiltered browsing dataset. Search requests are suppressed, but explicit unfiltered pagination still uses `loadMore`. When input crosses into eligible search, Core starts at the configured first page and retains the independent browse items and continuation. Returning below threshold or calling `clearSearch()` cancels an active qualifying search and restores that browse state; completions from the canceled query are stale. An accepted runtime threshold update also projects a changed restored snapshot into the visible options, including when the update is deferred until an in-progress result projection settles. Page-mode browsing treats nonempty initial items as the configured `initialPage` and continues at the next page; with no initial items, the first unfiltered request starts at `initialPage`. The host must complete load-more requests with `hasMore: true` or `status: 'exhausted'`/`hasMore: false` to advance or end browsing; Core does not infer server exhaustion from the item count.
|
|
74
91
|
|
|
75
|
-
This
|
|
92
|
+
This opt-in behavior is available in `@smilodon/core@1.19.0`. See [the Issue #109 qualification record](../../docs/architecture/ISSUE-109-MIN-SEARCH-CHARACTERS.md) and [release record](../../docs/releases/WEB-1.19.0-RELEASE.md).
|
|
76
93
|
|
|
77
94
|
```ts
|
|
78
95
|
import { EnhancedSelect } from '@smilodon/core'
|
|
@@ -617,6 +634,7 @@ enhanced-select.dark-mode {
|
|
|
617
634
|
--select-arrow-width /* Container width (40px) */
|
|
618
635
|
--select-arrow-container-position /* Arrow container position (absolute) */
|
|
619
636
|
--select-arrow-border-radius /* Container border radius */
|
|
637
|
+
--select-dropdown-arrow-container-padding /* Padding inside the arrow container (0) */
|
|
620
638
|
|
|
621
639
|
/* Group headers (when using groupedItems or flat items with `group` property) */
|
|
622
640
|
--select-group-header-padding /* Padding inside header (8px 12px) */
|
|
@@ -639,6 +657,17 @@ enhanced-select.dark-mode {
|
|
|
639
657
|
--select-checkmark-color
|
|
640
658
|
```
|
|
641
659
|
|
|
660
|
+
The inner selected-value/chip/search wrapper and the arrow container have independent padding tokens:
|
|
661
|
+
|
|
662
|
+
```css
|
|
663
|
+
enhanced-select {
|
|
664
|
+
--select-input-content-padding: 4px;
|
|
665
|
+
--select-dropdown-arrow-container-padding: 8px 4px;
|
|
666
|
+
}
|
|
667
|
+
```
|
|
668
|
+
|
|
669
|
+
Both accept the standard CSS `padding` shorthand and update live. The input-content token does not affect the outer `--select-input-padding` shell. When unset, wrap/vertical multi-select keeps its 12px logical inline-end gap; horizontal multi-select keeps zero content padding and its separate arrow/clear scroll-padding. Explicit input-content padding replaces the complete mode-specific fallback.
|
|
670
|
+
|
|
642
671
|
**Dark Mode (Opt-in)**
|
|
643
672
|
```css
|
|
644
673
|
--select-dark-bg /* Dark input background (#1f2937) */
|
|
@@ -676,11 +705,48 @@ The component implements keyboard interaction paths including:
|
|
|
676
705
|
| `PageUp` / `PageDown` | Jump 10 options up/down |
|
|
677
706
|
| `Escape` | Close dropdown |
|
|
678
707
|
| `Tab` | Close dropdown and move focus |
|
|
679
|
-
| `
|
|
708
|
+
| `Space` in a searchable input | Insert a space at the caret and update search through the native input event |
|
|
709
|
+
| `Space` in a non-searchable select | Activate the active option |
|
|
710
|
+
| `Enter` | Activate the active option |
|
|
711
|
+
| `Ctrl+A` / `Cmd+A` in a searchable input | Use the browser's native select-all-text behavior; selected options are unchanged |
|
|
712
|
+
| `Ctrl+A` / `Cmd+A` (non-searchable multi-select) | Select all options |
|
|
680
713
|
| Type characters | Type-ahead search |
|
|
681
714
|
|
|
682
715
|
When an empty single-select opens, it has no active option and does not expose `aria-activedescendant` until keyboard navigation begins. Press `ArrowDown` to activate the first selectable option. If a value is already selected, opening the list activates that selected option.
|
|
683
716
|
|
|
717
|
+
When `scrollToSelected.enabled` is on, active and ARIA state are updated immediately on open. Core waits for the dropdown's finite entrance animation to settle before applying the opening policy. The default `onOpen: 'reveal'` moves the internal options scroller only when the selected target is not fully visible. Use `onOpen: 'align'` to apply `block: 'start' | 'center' | 'end' | 'nearest'` even when the target is visible, subject to scroll bounds. Use `onOpen: 'preserve'` to retain the viewport; when selected-first ordering changes between openings, Core anchors the first visible option by stable key and restores its viewport offset. If the anchor disappears, the previous scroll position is clamped to the new bounds. Disabling the setting or keyboard and deliberate pointer/scroll input cancel pending automatic movement.
|
|
718
|
+
|
|
719
|
+
```ts
|
|
720
|
+
select.updateConfig({
|
|
721
|
+
scrollToSelected: {
|
|
722
|
+
enabled: true,
|
|
723
|
+
onOpen: 'align', // 'preserve' | 'reveal' | 'align'; default: 'reveal'
|
|
724
|
+
multiSelectTarget: 'first',
|
|
725
|
+
behavior: 'smooth', // 'auto' | 'instant' | 'smooth'
|
|
726
|
+
block: 'center', // 'start' | 'center' | 'end' | 'nearest'
|
|
727
|
+
},
|
|
728
|
+
})
|
|
729
|
+
```
|
|
730
|
+
|
|
731
|
+
The policy is snapshotted for each opening; changing it while the entrance operation is pending does not start a competing transaction. Only the internal options scroller is moved. See the [Issue #116 implementation record](../../docs/architecture/ISSUE-116-DROPDOWN-OPEN-SCROLL.md) and [selected-options projection record](../../docs/architecture/SELECTED-OPTIONS-PROJECTION.md).
|
|
732
|
+
|
|
733
|
+
### Selected option presentation order
|
|
734
|
+
|
|
735
|
+
Core can optionally present selected options before unselected options while preserving each partition's original order. The default is `original`, so existing consumers keep source order. For grouped options, `selected-first` promotes selected options only within their current groups; group order and identity do not change.
|
|
736
|
+
|
|
737
|
+
```ts
|
|
738
|
+
import { configureSelect } from '@smilodon/core';
|
|
739
|
+
|
|
740
|
+
configureSelect({
|
|
741
|
+
selectedOptions: {
|
|
742
|
+
placement: 'selected-first', // 'original' | 'selected-first'
|
|
743
|
+
groupedPlacement: 'within-group',
|
|
744
|
+
},
|
|
745
|
+
});
|
|
746
|
+
```
|
|
747
|
+
|
|
748
|
+
The same partial setting can be applied to an instance with `select.updateConfig({ selectedOptions: { placement: 'selected-first' } })`. Core snapshots the policy and selected membership when the dropdown opens. Changing the setting or selection while the list is open does not reshuffle that opening; close and reopen to apply the current values. Selection styling and events still reflect current selection immediately. Web adapter forwarding is included in the `1.20.0` release; React Native runtime behavior is not qualified. See the [selected-options projection record](../../docs/architecture/SELECTED-OPTIONS-PROJECTION.md).
|
|
749
|
+
|
|
684
750
|
**Multi-Select Range Selection:**
|
|
685
751
|
- `Shift + ↑/↓` - Range selection
|
|
686
752
|
- `Ctrl/Cmd + Click` - Toggle individual items
|
|
@@ -873,6 +939,39 @@ enhanced-select {
|
|
|
873
939
|
}
|
|
874
940
|
```
|
|
875
941
|
|
|
942
|
+
#### Multi-select chip animations
|
|
943
|
+
|
|
944
|
+
Core exposes separate entry and opt-in exit animation tokens. The legacy
|
|
945
|
+
`--select-badge-animation` continues to control entry when
|
|
946
|
+
`--select-badge-enter-animation` is unset. Exit defaults to `none`, so the
|
|
947
|
+
selected value is removed immediately unless an exit animation is configured.
|
|
948
|
+
|
|
949
|
+
```css
|
|
950
|
+
enhanced-select {
|
|
951
|
+
--select-badge-enter-animation: badgeEnter 180ms ease-out both;
|
|
952
|
+
--select-badge-exit-animation: badgeExit 140ms ease-in both;
|
|
953
|
+
}
|
|
954
|
+
```
|
|
955
|
+
|
|
956
|
+
`badgeEnter` and `badgeExit` are built-in keyframes. Arbitrary keyframe names
|
|
957
|
+
declared in the consuming document cannot be resolved from inside the
|
|
958
|
+
component's Shadow DOM through a custom property. Use the exposed parts for
|
|
959
|
+
consumer-defined keyframes:
|
|
960
|
+
|
|
961
|
+
```css
|
|
962
|
+
@keyframes app-chip-exit {
|
|
963
|
+
to { opacity: 0; transform: translateY(-6px) scale(0.96); }
|
|
964
|
+
}
|
|
965
|
+
|
|
966
|
+
enhanced-select::part(chip-exiting) {
|
|
967
|
+
animation: app-chip-exit 140ms ease-in both;
|
|
968
|
+
}
|
|
969
|
+
```
|
|
970
|
+
|
|
971
|
+
Selection state and events update immediately. The exiting chip remains only
|
|
972
|
+
for its visual animation and is inert, hidden from assistive technology, and
|
|
973
|
+
removed on animation completion (or immediately for reduced motion).
|
|
974
|
+
|
|
876
975
|
**Complete CSS Variables Reference**
|
|
877
976
|
|
|
878
977
|
The canonical styling inventory now lives in:
|