@smilodon/core 1.18.0 → 1.20.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 +88 -6
- package/dist/index.cjs +1129 -155
- package/dist/index.cjs.map +1 -1
- package/dist/index.js +1127 -156
- 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 +1129 -155
- 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 +30 -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 +7 -2
- package/dist/types/src/data-loading/request-coordinator.d.ts +9 -0
- 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,6 +14,21 @@
|
|
|
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
|
+
> **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
|
+
|
|
17
32
|
## Custom busy bucket (Core 1.13.0)
|
|
18
33
|
|
|
19
34
|
Introduced in `@smilodon/core@1.13.0` (Issue #90), the busy bucket keeps request state in Core and lets the host customize its presentation. Use the native slots with the Web Component or Vanilla API:
|
|
@@ -45,12 +60,33 @@ select.updateConfig({
|
|
|
45
60
|
|
|
46
61
|
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.
|
|
47
62
|
|
|
48
|
-
## Acknowledged data loading
|
|
63
|
+
## Acknowledged data loading
|
|
49
64
|
|
|
50
|
-
The
|
|
65
|
+
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.
|
|
51
66
|
|
|
52
67
|
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`.
|
|
53
68
|
|
|
69
|
+
### Minimum length for acknowledged remote search — Issue #109
|
|
70
|
+
|
|
71
|
+
Set `dataLoading.minSearchCharacters` to keep short input from creating a remote search request. Core checks the setting in the request coordinator before it allocates a request ID or enters the search busy state:
|
|
72
|
+
|
|
73
|
+
```ts
|
|
74
|
+
select.updateConfig({
|
|
75
|
+
dataLoading: {
|
|
76
|
+
protocol: 'acknowledged',
|
|
77
|
+
searchMode: 'remote',
|
|
78
|
+
fetchLimit: 25,
|
|
79
|
+
minSearchCharacters: 3,
|
|
80
|
+
},
|
|
81
|
+
})
|
|
82
|
+
```
|
|
83
|
+
|
|
84
|
+
The default is `0`, which preserves existing behavior. The threshold applies to acknowledged `remote` and `hybrid` search only; legacy and local search are unchanged. Core trims surrounding whitespace and counts Unicode code points with `Array.from(query.trim()).length` (not UTF-16 code units or user-perceived grapheme clusters). A value must be a non-negative safe integer. An invalid update is rejected atomically and does not cancel valid work.
|
|
85
|
+
|
|
86
|
+
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.
|
|
87
|
+
|
|
88
|
+
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).
|
|
89
|
+
|
|
54
90
|
```ts
|
|
55
91
|
import { EnhancedSelect } from '@smilodon/core'
|
|
56
92
|
|
|
@@ -215,15 +251,23 @@ The default chevron remains in place unless a light-DOM child is assigned to the
|
|
|
215
251
|
</enhanced-select>
|
|
216
252
|
```
|
|
217
253
|
|
|
218
|
-
The custom node is decorative and Core keeps ownership of the arrow click behavior. The built-in arrow rotates with the popup; a custom node does not rotate unless the consumer styles it using the host's `data-open="true"` state.
|
|
254
|
+
The custom node is decorative and Core keeps ownership of the arrow click behavior. The built-in arrow rotates with the popup; a custom node does not rotate unless the consumer styles it using the host's `data-open="true"` state. Core does not impose its arrow color or transform on assigned custom content. A custom arrow container honors `--select-arrow-hover-bg` on hover; if the token is unset, its background remains transparent. This behavior is available in `@smilodon/core@1.18.0` and fixes [Issue #104](https://github.com/navidrezadoost/Smilodon/issues/104).
|
|
255
|
+
|
|
256
|
+
The arrow container uses absolute positioning by default. Set `--select-arrow-container-position` to change its CSS `position` without reaching into the component's Shadow DOM:
|
|
219
257
|
|
|
220
258
|
```css
|
|
221
259
|
enhanced-select {
|
|
222
|
-
--select-arrow-
|
|
260
|
+
--select-arrow-container-position: static;
|
|
223
261
|
}
|
|
224
262
|
```
|
|
225
263
|
|
|
226
|
-
|
|
264
|
+
The default value is `absolute`, preserving the existing layout. Values such as `static` or `relative` make the arrow participate in the input shell's flex layout, so adjust other spacing tokens if needed. The CSS fallback applies when the token is unset; an invalid value is not normalized to `absolute`.
|
|
265
|
+
|
|
266
|
+
```css
|
|
267
|
+
enhanced-select {
|
|
268
|
+
--select-arrow-hover-bg: rgb(0 0 0 / 8%);
|
|
269
|
+
}
|
|
270
|
+
```
|
|
227
271
|
|
|
228
272
|
### Custom empty-state content (unreleased)
|
|
229
273
|
|
|
@@ -584,6 +628,7 @@ enhanced-select.dark-mode {
|
|
|
584
628
|
--select-arrow-hover-color /* Icon color when hovered (#667eea) */
|
|
585
629
|
--select-arrow-hover-bg /* Background when hover (rgba(102,126,234,0.08)) */
|
|
586
630
|
--select-arrow-width /* Container width (40px) */
|
|
631
|
+
--select-arrow-container-position /* Arrow container position (absolute) */
|
|
587
632
|
--select-arrow-border-radius /* Container border radius */
|
|
588
633
|
|
|
589
634
|
/* Group headers (when using groupedItems or flat items with `group` property) */
|
|
@@ -594,7 +639,7 @@ enhanced-select.dark-mode {
|
|
|
594
639
|
--select-group-header-color /* Text color (#6b7280) */
|
|
595
640
|
--select-group-header-bg /* Background (#f3f4f6) */
|
|
596
641
|
--select-group-header-font-size
|
|
597
|
-
--select-group-header-text-align /* Header text alignment (
|
|
642
|
+
--select-group-header-text-align /* Header text alignment (logical start by default) */
|
|
598
643
|
--select-group-header-text-transform
|
|
599
644
|
--select-group-header-letter-spacing
|
|
600
645
|
--select-group-header-border-bottom
|
|
@@ -649,6 +694,39 @@ The component implements keyboard interaction paths including:
|
|
|
649
694
|
|
|
650
695
|
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.
|
|
651
696
|
|
|
697
|
+
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.
|
|
698
|
+
|
|
699
|
+
```ts
|
|
700
|
+
select.updateConfig({
|
|
701
|
+
scrollToSelected: {
|
|
702
|
+
enabled: true,
|
|
703
|
+
onOpen: 'align', // 'preserve' | 'reveal' | 'align'; default: 'reveal'
|
|
704
|
+
multiSelectTarget: 'first',
|
|
705
|
+
behavior: 'smooth', // 'auto' | 'instant' | 'smooth'
|
|
706
|
+
block: 'center', // 'start' | 'center' | 'end' | 'nearest'
|
|
707
|
+
},
|
|
708
|
+
})
|
|
709
|
+
```
|
|
710
|
+
|
|
711
|
+
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).
|
|
712
|
+
|
|
713
|
+
### Selected option presentation order
|
|
714
|
+
|
|
715
|
+
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.
|
|
716
|
+
|
|
717
|
+
```ts
|
|
718
|
+
import { configureSelect } from '@smilodon/core';
|
|
719
|
+
|
|
720
|
+
configureSelect({
|
|
721
|
+
selectedOptions: {
|
|
722
|
+
placement: 'selected-first', // 'original' | 'selected-first'
|
|
723
|
+
groupedPlacement: 'within-group',
|
|
724
|
+
},
|
|
725
|
+
});
|
|
726
|
+
```
|
|
727
|
+
|
|
728
|
+
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).
|
|
729
|
+
|
|
652
730
|
**Multi-Select Range Selection:**
|
|
653
731
|
- `Shift + ↑/↓` - Range selection
|
|
654
732
|
- `Ctrl/Cmd + Click` - Toggle individual items
|
|
@@ -967,12 +1045,16 @@ select.updateConfig({
|
|
|
967
1045
|
|
|
968
1046
|
RTL support mirrors the shell and dropdown layout, including arrow placement, clear control placement, separator side, selected indicator side, and chip remove spacing. The host `dir` attribute is kept in sync automatically.
|
|
969
1047
|
|
|
1048
|
+
Set direction through `configureSelect({ direction })` or `select.updateConfig({ direction })`. The host `dir` attribute reflects the configured direction; a `dir` value supplied before connection can be replaced by the configured default, and a later configuration update can replace a directly assigned attribute. Use the configuration API when setting direction so it remains consistent across updates.
|
|
1049
|
+
|
|
970
1050
|
**Badge Remove/Delete Button (Multi-Select)**
|
|
971
1051
|
The × button that removes selected items in multi-select mode is fully customizable:
|
|
972
1052
|
|
|
973
1053
|
**Group Header & No‑Results Parts**
|
|
974
1054
|
Both the group header and the no-results message are exposed as shadow parts (`group-header` and `no-results`) so you can target them with `::part()` selectors or CSS variables. This makes it straightforward to match the look of your host framework or UI kit.
|
|
975
1055
|
|
|
1056
|
+
Group headers default to logical `start` alignment, so they appear left-aligned in LTR and right-aligned in RTL. Override the default when needed, for example `--select-group-header-text-align: left`; `right` and `center` are also supported. The default follows direction changes dynamically.
|
|
1057
|
+
|
|
976
1058
|
|
|
977
1059
|
```css
|
|
978
1060
|
enhanced-select {
|