@su-labs/select 0.0.0-stage → 19.0.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/CHANGELOG.md ADDED
@@ -0,0 +1,19 @@
1
+ # Changelog
2
+
3
+ All notable changes to this project will be documented in this file.
4
+
5
+ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
6
+ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
7
+
8
+ ## [22.0.0] - 2026-11-18
9
+
10
+ ### Added
11
+
12
+ - `su-lib-select`: a select with its own styled trigger and list instead of the browser's popup, `[options]` of `{ value, label, disabled?, group? }` and `[(value)]` of any type
13
+ - `searchable`: a search field at the top of the list that filters the options, ignoring case and accents
14
+ - Groups listed under their heading (`role="group"`), and disabled options that are shown but can't be chosen
15
+ - The WAI-ARIA select-only combobox pattern: `role="combobox"` with `aria-expanded`, `aria-controls` and `aria-activedescendant`; arrows, Home, End, Page Up and Page Down, type-ahead (choosing at once while closed), Enter, Space or Alt + ↑ to choose, Escape to close and Tab to choose and move on
16
+ - The list opens in the top layer (`popover`), below the trigger or above it when there's no room, follows the trigger while the page scrolls and closes once it's out of view, and fades in unless the user prefers less motion (`animated`)
17
+ - `(chosen)`: the value the user chose, typed without `null`, not emitted for a value set from outside
18
+ - `[(open)]`, `[(touched)]`, `disabled`, `placeholder`, `ariaLabel`, `ariaLabelledby`, `focus()`
19
+ - `labels` to replace the texts (`SU_SELECT_LABELS`), and `--su-select-*` CSS variables for the look
package/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2025 Yevheniy Alekseyev <yev.alekseyev@gmail.com>
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
package/README.md CHANGED
@@ -1,3 +1,139 @@
1
- # Temporary Holding Version
1
+ # Select
2
2
 
3
- This version is a temporary placeholder for this package. An operational version to replace this has been submitted for review and is awaiting a staged release.
3
+ `@su-labs/select`
4
+
5
+ ![Angular Version](https://img.shields.io/badge/Angular-v22-DD0031?style=for-the-badge&logo=angular&logoColor=white)
6
+ ![License](https://img.shields.io/badge/License-MIT-blue.svg?style=for-the-badge)
7
+
8
+ A select for Angular with its own styled list instead of the browser's popup:
9
+
10
+ - **Styled to match**: the trigger and the list follow your theme through CSS variables, the same in every browser and on every system.
11
+ - **Search**: an optional field at the top of the list filters the options, ignoring case and accents.
12
+ - **Groups and disabled options**: headings over related options; disabled options are shown but can't be chosen.
13
+ - **Keyboard**: arrows, Home and End, type-ahead (even while closed, like a native select), Enter or Space to choose, Escape to close, Tab to choose and move on.
14
+ - **Never cut off**: the list opens in the top layer, below the trigger or above it when there's no room.
15
+ - **Accessible**: the WAI-ARIA select-only combobox pattern, with `aria-expanded` and `aria-activedescendant`.
16
+
17
+ ## Installation
18
+
19
+ ```bash
20
+ npm install @su-labs/select@ng19
21
+ ```
22
+
23
+ This is the Angular 19 version. For the newest Angular, install `@su-labs/select` without a tag.
24
+
25
+ ## Usage
26
+
27
+ ```ts
28
+ import { SuSelectOption } from '@su-labs/core/select';
29
+ import { SuSelectComponent } from '@su-labs/select';
30
+
31
+ @Component({
32
+ imports: [SuSelectComponent],
33
+ })
34
+ export class Settings {
35
+ readonly sizes: SuSelectOption<string>[] = [
36
+ { value: 's', label: 'Small' },
37
+ { value: 'm', label: 'Medium' },
38
+ { value: 'l', label: 'Large', disabled: true },
39
+ ];
40
+ readonly size = signal<string | null>('m');
41
+ }
42
+ ```
43
+
44
+ ```html
45
+ <label>
46
+ Size
47
+ <su-lib-select [options]="sizes" [(value)]="size" />
48
+ </label>
49
+
50
+ <su-lib-select
51
+ [options]="countries"
52
+ [(value)]="country"
53
+ searchable
54
+ aria-label="Country" />
55
+ ```
56
+
57
+ An option is `{ value, label, disabled?, group? }`; options sharing a `group` are listed under its heading, so keep them next to each other. The value can be any type: it's compared with `Object.is`, so objects must be the same instances as in `options`.
58
+
59
+ `value` is a `model()`, so it works with `[(value)]`, signals and signal forms. To keep a signal that is never `null`, bind `[value]="size()" (chosen)="size.set($event)"`. A `<label>` around the select names it; otherwise use `ariaLabel` or `ariaLabelledby`.
60
+
61
+ | Input | Default | |
62
+ | ---------------- | ----------- | --------------------------------------------------- |
63
+ | `options` | `[]` | The choices: `SuSelectOption<T>[]` |
64
+ | `[(value)]` | `null` | The chosen value, or `null` while nothing is chosen |
65
+ | `[(open)]` | `false` | Whether the list is open |
66
+ | `[(touched)]` | `false` | Set once focus has left the select |
67
+ | `searchable` | `false` | A search field at the top of the list |
68
+ | `disabled` | `false` | Can't be opened or focused |
69
+ | `animated` | `true` | The list fades and slides in |
70
+ | `placeholder` | `'Choose…'` | Shown while nothing is chosen |
71
+ | `ariaLabel` | — | The select's name, without a `<label>` |
72
+ | `ariaLabelledby` | — | The id of the element that names it |
73
+ | `labels` | English | Texts to replace: `placeholder`, `search`, `empty` |
74
+
75
+ | Output | |
76
+ | ---------- | ----------------------------------------------------------------------------------------------------------- |
77
+ | `(chosen)` | The user chose an option: its value, typed `T` (never `null`); not emitted when `value` is set from outside |
78
+
79
+ | Method | |
80
+ | --------- | -------------------------- |
81
+ | `focus()` | Moves focus to the trigger |
82
+
83
+ ## Accessibility
84
+
85
+ - The trigger is a button with `role="combobox"`, `aria-haspopup="listbox"`, `aria-expanded` and `aria-controls`; the list is a `listbox` of `option`s with `aria-selected` and `aria-disabled`, and groups are `role="group"` named by their heading.
86
+ - Focus stays on the trigger; `aria-activedescendant` points at the option the keyboard is on. With `searchable`, focus moves to the search field while the list is open, and it carries `aria-activedescendant` instead.
87
+ - Closed: ↓, ↑, Enter or Space open the list; Home and End open it on the first or last option; typing a letter chooses the next option starting with it.
88
+ - Open: ↑ and ↓ move (skipping disabled options), Home and End or Page Up and Page Down jump to either end, typing jumps to a matching option, Enter, Space or Alt + ↑ choose, Escape closes, Tab chooses and moves on.
89
+ - A click outside, focus leaving or scrolling the trigger out of view closes it, like a native select. Animation is off when the user prefers reduced motion.
90
+
91
+ The list opens in the top layer (`popover="manual"`), so no `overflow: hidden` or `z-index` around it cuts it off.
92
+
93
+ ## Theming
94
+
95
+ | Variable | Default | |
96
+ | -------------------------------------- | --------------------------------- | ------------------------------------------ |
97
+ | `--su-select-background` | `#fff` | The trigger, and the list unless set apart |
98
+ | `--su-select-color` | `#111827` | |
99
+ | `--su-select-muted-color` | `#6b7280` | Placeholder, chevron, group headings |
100
+ | `--su-select-border` | `1px solid #d1d5db` | |
101
+ | `--su-select-hover-border-color` | `#9ca3af` | |
102
+ | `--su-select-radius` | `0.375rem` | |
103
+ | `--su-select-padding` | `0.375rem 0.625rem` | |
104
+ | `--su-select-height` | `2.25rem` | The trigger's least height |
105
+ | `--su-select-min-width` | `8rem` | |
106
+ | `--su-select-font-size` | `0.875rem` | |
107
+ | `--su-select-focus-ring` | `0 0 0 3px rgb(37 99 235 / 0.35)` | A `box-shadow` |
108
+ | `--su-select-disabled-opacity` | `0.5` | |
109
+ | `--su-select-list-background` | the background | |
110
+ | `--su-select-list-border` | the border | |
111
+ | `--su-select-list-radius` | `0.5rem` | |
112
+ | `--su-select-list-shadow` | `0 10px 30px rgb(0 0 0 / 0.12)` | |
113
+ | `--su-select-list-padding` | `0.25rem` | |
114
+ | `--su-select-list-max-height` | `18rem` | |
115
+ | `--su-select-search-border` | `1px solid #e5e7eb` | Under the search field |
116
+ | `--su-select-option-padding` | `0.4rem 0.5rem` | |
117
+ | `--su-select-option-radius` | `0.3125rem` | |
118
+ | `--su-select-option-active-background` | `#f3f4f6` | The option under the keyboard or pointer |
119
+ | `--su-select-option-selected-color` | `inherit` | |
120
+ | `--su-select-option-selected-weight` | `600` | |
121
+ | `--su-select-duration` | `160ms` | |
122
+ | `--su-select-z-index` | `1000` | Only in browsers without the popover API |
123
+
124
+ ```css
125
+ su-lib-select {
126
+ --su-select-background: #0f172a;
127
+ --su-select-color: #f8fafc;
128
+ --su-select-border: 1px solid #334155;
129
+ --su-select-option-active-background: #1e293b;
130
+ }
131
+ ```
132
+
133
+ ## Without Angular
134
+
135
+ Opening, the active option, search, groups and type-ahead come from [`@su-labs/core/select`](https://www.npmjs.com/package/@su-labs/core), for vanilla JS, React, Vue or Svelte.
136
+
137
+ ## License
138
+
139
+ MIT
@@ -0,0 +1,306 @@
1
+ import { DOCUMENT } from '@angular/common';
2
+ import * as i0 from '@angular/core';
3
+ import { input, model, booleanAttribute, output, computed, signal, inject, ElementRef, viewChild, DestroyRef, effect, untracked, afterRenderEffect, ChangeDetectionStrategy, Component } from '@angular/core';
4
+ import { SU_SELECT_LABELS, SuSelectController, suSelectGroups } from '@su-labs/core/select';
5
+ import { suTooltipPosition } from '@su-labs/core/tooltip';
6
+
7
+ let nextSelectId = 0;
8
+ const MOVES = {
9
+ ArrowDown: 'next',
10
+ ArrowUp: 'previous',
11
+ Home: 'first',
12
+ End: 'last',
13
+ PageDown: 'last',
14
+ PageUp: 'first',
15
+ };
16
+ /**
17
+ * A select over `SuSelectController` from `@su-labs/core/select`, with its own styled list instead of the browser's
18
+ * popup: `<su-lib-select [options]="sizes" [(value)]="size" />`. The trigger is a `combobox` button and the list a
19
+ * `listbox` in the top layer (`popover`), placed below the trigger or above it when there's no room. It follows the
20
+ * WAI-ARIA select-only combobox pattern: arrows, Home and End, type-ahead, Enter or Space to choose, Escape to close
21
+ * and Tab to choose and move on. With `searchable`, a search field at the top of the list filters the options.
22
+ */
23
+ class SuSelectComponent {
24
+ /** The choices: `{ value, label, disabled?, group? }`; options sharing a `group` should follow one another */
25
+ options = input([]);
26
+ /** The chosen value, or `null` while nothing is chosen */
27
+ value = model(null);
28
+ /** Whether the list is open; setting it opens or closes it */
29
+ open = model(false);
30
+ /** Set once focus has left the select, for forms that show errors after the user moved on */
31
+ touched = model(false);
32
+ /** A search field at the top of the list that filters the options @default false */
33
+ searchable = input(false, { transform: booleanAttribute });
34
+ /** Can't be opened or focused @default false */
35
+ disabled = input(false, { transform: booleanAttribute });
36
+ /** Opens with a short fade and slide; off when the user prefers less motion @default true */
37
+ animated = input(true, { transform: booleanAttribute });
38
+ /** Shown while nothing is chosen @default labels.placeholder */
39
+ placeholder = input();
40
+ /** The select's name for screen readers, when no `<label>` wraps it and no `ariaLabelledby` names it */
41
+ ariaLabel = input();
42
+ /** The id of the element that names the select */
43
+ ariaLabelledby = input();
44
+ /** Texts to replace, e.g. in the page's language */
45
+ labels = input({});
46
+ /** The user chose an option (never emitted for a value set from outside): its value */
47
+ chosen = output();
48
+ id = `su-select-${nextSelectId++}`;
49
+ listId = `${this.id}-list`;
50
+ texts = computed(() => ({
51
+ ...SU_SELECT_LABELS,
52
+ ...this.labels(),
53
+ }));
54
+ controller = new SuSelectController();
55
+ state = signal(this.controller.state.get());
56
+ groups = computed(() => suSelectGroups(this.state().visible));
57
+ selected = computed(() => {
58
+ this.state();
59
+ return this.controller.selected;
60
+ });
61
+ activeId = computed(() => {
62
+ const { open, active } = this.state();
63
+ return open && active >= 0 ? this.optionId(active) : null;
64
+ });
65
+ host = inject(ElementRef);
66
+ document = inject(DOCUMENT);
67
+ trigger = viewChild.required('trigger');
68
+ panel = viewChild.required('panel');
69
+ search = viewChild('search');
70
+ constructor() {
71
+ let previous = this.controller.state.get();
72
+ const unsubscribe = this.controller.state.subscribe(state => {
73
+ this.state.set(state);
74
+ if (state.value !== previous.value) {
75
+ this.value.set(state.value);
76
+ }
77
+ if (state.open !== previous.open) {
78
+ this.open.set(state.open);
79
+ }
80
+ previous = state;
81
+ });
82
+ inject(DestroyRef).onDestroy(unsubscribe);
83
+ effect(() => {
84
+ const options = this.options();
85
+ untracked(() => this.controller.setOptions(options));
86
+ });
87
+ effect(() => {
88
+ const value = this.value();
89
+ untracked(() => this.controller.setValue(value));
90
+ });
91
+ effect(() => {
92
+ const open = this.open() && !this.disabled();
93
+ untracked(() => open ? this.controller.open() : this.controller.close());
94
+ });
95
+ effect(onCleanup => {
96
+ if (!this.state().open) {
97
+ return;
98
+ }
99
+ const onPointerDown = (event) => this.onDocumentPointerDown(event);
100
+ const onMove = () => this.follow();
101
+ const view = this.document.defaultView;
102
+ this.document.addEventListener('pointerdown', onPointerDown);
103
+ view?.addEventListener('scroll', onMove, true);
104
+ view?.addEventListener('resize', onMove);
105
+ onCleanup(() => {
106
+ this.document.removeEventListener('pointerdown', onPointerDown);
107
+ view?.removeEventListener('scroll', onMove, true);
108
+ view?.removeEventListener('resize', onMove);
109
+ });
110
+ });
111
+ afterRenderEffect(() => {
112
+ const open = this.state().open;
113
+ untracked(() => (open ? this.reveal() : this.conceal()));
114
+ });
115
+ afterRenderEffect(() => {
116
+ const id = this.activeId();
117
+ const option = id ? this.document.getElementById(id) : null;
118
+ if (option && typeof option.scrollIntoView === 'function') {
119
+ option.scrollIntoView({ block: 'nearest' });
120
+ }
121
+ });
122
+ }
123
+ /** Moves focus to the trigger */
124
+ focus() {
125
+ this.trigger().nativeElement.focus();
126
+ }
127
+ optionId(index) {
128
+ return `${this.id}-option-${index}`;
129
+ }
130
+ isSelected(option) {
131
+ return option === this.selected();
132
+ }
133
+ toggle() {
134
+ if (!this.disabled()) {
135
+ this.controller.toggle();
136
+ }
137
+ }
138
+ choose(index) {
139
+ this.byUser(() => this.pick(index));
140
+ }
141
+ activate(index) {
142
+ if (index !== this.state().active) {
143
+ this.controller.activate(index);
144
+ }
145
+ }
146
+ onSearch(event) {
147
+ if (event.target instanceof HTMLInputElement) {
148
+ this.controller.search(event.target.value);
149
+ }
150
+ }
151
+ onKeydown(event) {
152
+ if (this.disabled() || event.ctrlKey || event.metaKey) {
153
+ return;
154
+ }
155
+ this.byUser(() => this.state().open
156
+ ? this.onOpenKeydown(event)
157
+ : this.onClosedKeydown(event));
158
+ }
159
+ onFocusOut(event) {
160
+ const next = event.relatedTarget;
161
+ if (next instanceof Node && this.host.nativeElement.contains(next)) {
162
+ return;
163
+ }
164
+ this.controller.close();
165
+ this.touched.set(true);
166
+ }
167
+ onClosedKeydown(event) {
168
+ const move = MOVES[event.key];
169
+ if (move || event.key === 'Enter' || event.key === ' ') {
170
+ event.preventDefault();
171
+ this.controller.open();
172
+ if (move === 'first' || move === 'last') {
173
+ this.controller.move(move);
174
+ }
175
+ return;
176
+ }
177
+ if (isPrintable(event)) {
178
+ event.preventDefault();
179
+ this.controller.typeAhead(event.key);
180
+ }
181
+ }
182
+ onOpenKeydown(event) {
183
+ const searching = this.searchable();
184
+ const move = MOVES[event.key];
185
+ if (event.key === 'ArrowUp' && event.altKey) {
186
+ event.preventDefault();
187
+ this.pick(this.state().active);
188
+ }
189
+ else if (move &&
190
+ !(searching && (event.key === 'Home' || event.key === 'End'))) {
191
+ event.preventDefault();
192
+ this.controller.move(move);
193
+ }
194
+ else if (event.key === 'Enter' || (event.key === ' ' && !searching)) {
195
+ event.preventDefault();
196
+ this.pick(this.state().active);
197
+ }
198
+ else if (event.key === 'Escape') {
199
+ event.preventDefault();
200
+ event.stopPropagation();
201
+ this.controller.close();
202
+ this.focus();
203
+ }
204
+ else if (event.key === 'Tab') {
205
+ this.controller.choose();
206
+ this.controller.close();
207
+ }
208
+ else if (!searching && isPrintable(event)) {
209
+ event.preventDefault();
210
+ this.controller.typeAhead(event.key);
211
+ }
212
+ }
213
+ pick(index) {
214
+ if (this.controller.choose(index)) {
215
+ this.focus();
216
+ }
217
+ }
218
+ byUser(action) {
219
+ const before = this.controller.state.get().value;
220
+ action();
221
+ const after = this.controller.state.get().value;
222
+ if (after !== null && after !== before) {
223
+ this.chosen.emit(after);
224
+ }
225
+ }
226
+ onDocumentPointerDown(event) {
227
+ const target = event.target;
228
+ if (!(target instanceof Node) ||
229
+ !this.host.nativeElement.contains(target)) {
230
+ this.controller.close();
231
+ }
232
+ }
233
+ reveal() {
234
+ const panel = this.panel().nativeElement;
235
+ panel.classList.add('su-select-shown');
236
+ if (typeof panel.showPopover === 'function' &&
237
+ !panel.matches(':popover-open')) {
238
+ panel.showPopover();
239
+ }
240
+ this.place();
241
+ const search = this.search()?.nativeElement;
242
+ if (search) {
243
+ search.value = '';
244
+ search.focus();
245
+ }
246
+ }
247
+ conceal() {
248
+ const panel = this.panel().nativeElement;
249
+ panel.classList.remove('su-select-shown');
250
+ if (typeof panel.hidePopover === 'function' &&
251
+ panel.matches(':popover-open')) {
252
+ panel.hidePopover();
253
+ }
254
+ }
255
+ follow() {
256
+ const trigger = this.trigger().nativeElement.getBoundingClientRect();
257
+ const height = this.document.defaultView?.innerHeight ?? 0;
258
+ if (trigger.bottom <= 0 || trigger.top >= height) {
259
+ this.controller.close();
260
+ return;
261
+ }
262
+ this.place();
263
+ }
264
+ place() {
265
+ if (!this.state().open) {
266
+ return;
267
+ }
268
+ const panel = this.panel().nativeElement;
269
+ const trigger = this.trigger().nativeElement.getBoundingClientRect();
270
+ const view = this.document.defaultView;
271
+ panel.style.minWidth = `${trigger.width}px`;
272
+ const position = suTooltipPosition(trigger, { width: panel.offsetWidth, height: panel.offsetHeight }, {
273
+ placement: 'bottom-start',
274
+ offset: 4,
275
+ viewport: {
276
+ width: this.document.documentElement.clientWidth,
277
+ height: view?.innerHeight ?? 0,
278
+ },
279
+ rtl: view?.getComputedStyle(this.host.nativeElement).direction === 'rtl',
280
+ });
281
+ panel.dataset['side'] = position.side;
282
+ panel.style.left = `${position.x}px`;
283
+ panel.style.top = `${position.y}px`;
284
+ }
285
+ static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.2.25", ngImport: i0, type: SuSelectComponent, deps: [], target: i0.ɵɵFactoryTarget.Component });
286
+ static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "19.2.25", type: SuSelectComponent, isStandalone: true, selector: "su-lib-select", inputs: { options: { classPropertyName: "options", publicName: "options", isSignal: true, isRequired: false, transformFunction: null }, value: { classPropertyName: "value", publicName: "value", isSignal: true, isRequired: false, transformFunction: null }, open: { classPropertyName: "open", publicName: "open", isSignal: true, isRequired: false, transformFunction: null }, touched: { classPropertyName: "touched", publicName: "touched", isSignal: true, isRequired: false, transformFunction: null }, searchable: { classPropertyName: "searchable", publicName: "searchable", isSignal: true, isRequired: false, transformFunction: null }, disabled: { classPropertyName: "disabled", publicName: "disabled", isSignal: true, isRequired: false, transformFunction: null }, animated: { classPropertyName: "animated", publicName: "animated", isSignal: true, isRequired: false, transformFunction: null }, placeholder: { classPropertyName: "placeholder", publicName: "placeholder", isSignal: true, isRequired: false, transformFunction: null }, ariaLabel: { classPropertyName: "ariaLabel", publicName: "ariaLabel", isSignal: true, isRequired: false, transformFunction: null }, ariaLabelledby: { classPropertyName: "ariaLabelledby", publicName: "ariaLabelledby", isSignal: true, isRequired: false, transformFunction: null }, labels: { classPropertyName: "labels", publicName: "labels", isSignal: true, isRequired: false, transformFunction: null } }, outputs: { value: "valueChange", open: "openChange", touched: "touchedChange", chosen: "chosen" }, host: { listeners: { "focusout": "onFocusOut($event)" }, properties: { "class.su-select-open": "open()", "class.su-select-disabled": "disabled()" }, classAttribute: "su-select" }, viewQueries: [{ propertyName: "trigger", first: true, predicate: ["trigger"], descendants: true, isSignal: true }, { propertyName: "panel", first: true, predicate: ["panel"], descendants: true, isSignal: true }, { propertyName: "search", first: true, predicate: ["search"], descendants: true, isSignal: true }], ngImport: i0, template: "<button\n #trigger\n type=\"button\"\n class=\"su-select-trigger\"\n role=\"combobox\"\n aria-haspopup=\"listbox\"\n [id]=\"id\"\n [disabled]=\"disabled()\"\n [attr.aria-expanded]=\"state().open\"\n [attr.aria-controls]=\"listId\"\n [attr.aria-activedescendant]=\"searchable() ? null : activeId()\"\n [attr.aria-label]=\"ariaLabel() ?? null\"\n [attr.aria-labelledby]=\"ariaLabelledby() ?? null\"\n (click)=\"toggle()\"\n (keydown)=\"onKeydown($event)\">\n <span class=\"su-select-value\" [class.su-select-placeholder]=\"!selected()\">{{ selected()?.label ?? placeholder() ?? texts().placeholder }}</span>\n <svg class=\"su-select-chevron\" viewBox=\"0 0 24 24\" aria-hidden=\"true\"><path d=\"m6 9 6 6 6-6\" /></svg>\n</button>\n<div #panel popover=\"manual\" class=\"su-select-panel\" [class.su-select-animated]=\"animated()\">\n @if (searchable()) {\n <input\n #search\n type=\"text\"\n class=\"su-select-search\"\n role=\"combobox\"\n autocomplete=\"off\"\n spellcheck=\"false\"\n aria-autocomplete=\"list\"\n aria-expanded=\"true\"\n [attr.aria-controls]=\"listId\"\n [attr.aria-activedescendant]=\"activeId()\"\n [attr.aria-label]=\"texts().search\"\n [placeholder]=\"texts().search\"\n (input)=\"onSearch($event)\"\n (keydown)=\"onKeydown($event)\" />\n }\n <ul class=\"su-select-list\" role=\"listbox\" tabindex=\"-1\" [id]=\"listId\" [attr.aria-label]=\"ariaLabel() ?? null\" [attr.aria-labelledby]=\"ariaLabel() ? null : (ariaLabelledby() ?? id)\" (mousedown)=\"$event.preventDefault()\">\n @for (group of groups(); track $index) {\n <li role=\"presentation\">\n <ul class=\"su-select-group\" [attr.role]=\"group.label ? 'group' : 'presentation'\" [attr.aria-labelledby]=\"group.label ? id + '-group-' + $index : null\">\n @if (group.label) {\n <li role=\"presentation\" class=\"su-select-group-label\" [id]=\"id + '-group-' + $index\">{{ group.label }}</li>\n }\n @for (item of group.options; track item.index) {\n <!-- eslint-disable-next-line @angular-eslint/template/click-events-have-key-events, @angular-eslint/template/interactive-supports-focus -- the combobox handles the keyboard through aria-activedescendant -->\n <li\n role=\"option\"\n class=\"su-select-option\"\n [id]=\"optionId(item.index)\"\n [class.su-select-active]=\"item.index === state().active\"\n [attr.aria-selected]=\"isSelected(item.option)\"\n [attr.aria-disabled]=\"item.option.disabled ? true : null\"\n (click)=\"choose(item.index)\"\n (pointermove)=\"activate(item.index)\">\n <span class=\"su-select-option-label\">{{ item.option.label }}</span>\n <svg class=\"su-select-check\" viewBox=\"0 0 24 24\" aria-hidden=\"true\"><path d=\"M5 12.5l4.5 4.5L19 7.5\" /></svg>\n </li>\n }\n </ul>\n </li>\n } @empty {\n <li role=\"presentation\" class=\"su-select-empty\">{{ texts().empty }}</li>\n }\n </ul>\n</div>\n", styles: [":host{display:inline-block;max-width:100%;vertical-align:middle}.su-select-trigger{align-items:center;background:var(--su-select-background, #fff);border:var(--su-select-border, 1px solid #d1d5db);border-radius:var(--su-select-radius, .375rem);box-sizing:border-box;color:var(--su-select-color, #111827);cursor:pointer;display:inline-flex;font:inherit;font-size:var(--su-select-font-size, .875rem);gap:.5rem;justify-content:space-between;line-height:1.4;max-width:100%;min-height:var(--su-select-height, 2.25rem);min-width:var(--su-select-min-width, 8rem);padding:var(--su-select-padding, .375rem .625rem);text-align:start;transition:border-color .15s,box-shadow .15s;width:100%}.su-select-trigger:hover:not(:disabled){border-color:var(--su-select-hover-border-color, #9ca3af)}.su-select-trigger:focus-visible{box-shadow:var(--su-select-focus-ring, 0 0 0 3px rgba(37, 99, 235, .35));outline:none}.su-select-trigger:disabled{cursor:not-allowed;opacity:var(--su-select-disabled-opacity, .5)}.su-select-value{overflow:hidden;text-overflow:ellipsis;white-space:nowrap}.su-select-placeholder{color:var(--su-select-muted-color, #6b7280)}.su-select-chevron,.su-select-check{fill:none;flex:none;stroke:currentColor;stroke-linecap:round;stroke-linejoin:round;stroke-width:2}.su-select-chevron{block-size:1rem;color:var(--su-select-muted-color, #6b7280);inline-size:1rem;transition:transform .2s}:host(.su-select-open) .su-select-chevron{transform:rotate(180deg)}.su-select-panel{background:var(--su-select-list-background, var(--su-select-background, #fff));border:var(--su-select-list-border, var(--su-select-border, 1px solid #d1d5db));border-radius:var(--su-select-list-radius, .5rem);box-shadow:var(--su-select-list-shadow, 0 10px 30px rgba(0, 0, 0, .12));box-sizing:border-box;color:var(--su-select-color, #111827);display:none;flex-direction:column;font-family:inherit;font-size:var(--su-select-font-size, .875rem);inset:auto;margin:0;max-height:min(var(--su-select-list-max-height, 18rem),100vh - 16px);max-width:calc(100vw - 16px);overflow:hidden;padding:var(--su-select-list-padding, .25rem);position:fixed;z-index:var(--su-select-z-index, 1000)}.su-select-panel.su-select-shown{display:flex}.su-select-panel.su-select-animated.su-select-shown{animation:su-select-in var(--su-select-duration, .16s) cubic-bezier(.16,1,.3,1);transform-origin:top}.su-select-panel.su-select-animated.su-select-shown[data-side=top]{animation-name:su-select-in-above;transform-origin:bottom}.su-select-search{background:transparent;border:0;border-bottom:var(--su-select-search-border, 1px solid #e5e7eb);box-sizing:border-box;color:inherit;flex:none;font:inherit;margin-bottom:.25rem;outline:none;padding:.4rem .5rem;width:100%}.su-select-search::placeholder{color:var(--su-select-muted-color, #6b7280)}.su-select-list,.su-select-group{list-style:none;margin:0;padding:0}.su-select-list{outline:none;overflow-y:auto;overscroll-behavior:contain}.su-select-group-label{color:var(--su-select-muted-color, #6b7280);font-size:.75em;letter-spacing:.04em;padding:.5rem .5rem .2rem;text-transform:uppercase}.su-select-option{align-items:center;border-radius:var(--su-select-option-radius, .3125rem);cursor:pointer;display:flex;gap:1rem;justify-content:space-between;padding:var(--su-select-option-padding, .4rem .5rem);white-space:nowrap}.su-select-option.su-select-active{background:var(--su-select-option-active-background, #f3f4f6)}.su-select-option[aria-selected=true]{color:var(--su-select-option-selected-color, inherit);font-weight:var(--su-select-option-selected-weight, 600)}.su-select-option[aria-disabled=true]{cursor:not-allowed;opacity:var(--su-select-disabled-opacity, .5)}.su-select-check{block-size:1rem;inline-size:1rem;visibility:hidden}[aria-selected=true]>.su-select-check{visibility:visible}.su-select-empty{color:var(--su-select-muted-color, #6b7280);padding:var(--su-select-option-padding, .4rem .5rem)}@keyframes su-select-in{0%{opacity:0;transform:translateY(-4px) scaleY(.96)}}@keyframes su-select-in-above{0%{opacity:0;transform:translateY(4px) scaleY(.96)}}@media(prefers-reduced-motion:reduce){.su-select-panel.su-select-shown,.su-select-panel.su-select-shown[data-side=top]{animation:none}.su-select-chevron{transition:none}}\n"], changeDetection: i0.ChangeDetectionStrategy.OnPush });
287
+ }
288
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.25", ngImport: i0, type: SuSelectComponent, decorators: [{
289
+ type: Component,
290
+ args: [{ selector: 'su-lib-select', changeDetection: ChangeDetectionStrategy.OnPush, host: {
291
+ class: 'su-select',
292
+ '[class.su-select-open]': 'open()',
293
+ '[class.su-select-disabled]': 'disabled()',
294
+ '(focusout)': 'onFocusOut($event)',
295
+ }, template: "<button\n #trigger\n type=\"button\"\n class=\"su-select-trigger\"\n role=\"combobox\"\n aria-haspopup=\"listbox\"\n [id]=\"id\"\n [disabled]=\"disabled()\"\n [attr.aria-expanded]=\"state().open\"\n [attr.aria-controls]=\"listId\"\n [attr.aria-activedescendant]=\"searchable() ? null : activeId()\"\n [attr.aria-label]=\"ariaLabel() ?? null\"\n [attr.aria-labelledby]=\"ariaLabelledby() ?? null\"\n (click)=\"toggle()\"\n (keydown)=\"onKeydown($event)\">\n <span class=\"su-select-value\" [class.su-select-placeholder]=\"!selected()\">{{ selected()?.label ?? placeholder() ?? texts().placeholder }}</span>\n <svg class=\"su-select-chevron\" viewBox=\"0 0 24 24\" aria-hidden=\"true\"><path d=\"m6 9 6 6 6-6\" /></svg>\n</button>\n<div #panel popover=\"manual\" class=\"su-select-panel\" [class.su-select-animated]=\"animated()\">\n @if (searchable()) {\n <input\n #search\n type=\"text\"\n class=\"su-select-search\"\n role=\"combobox\"\n autocomplete=\"off\"\n spellcheck=\"false\"\n aria-autocomplete=\"list\"\n aria-expanded=\"true\"\n [attr.aria-controls]=\"listId\"\n [attr.aria-activedescendant]=\"activeId()\"\n [attr.aria-label]=\"texts().search\"\n [placeholder]=\"texts().search\"\n (input)=\"onSearch($event)\"\n (keydown)=\"onKeydown($event)\" />\n }\n <ul class=\"su-select-list\" role=\"listbox\" tabindex=\"-1\" [id]=\"listId\" [attr.aria-label]=\"ariaLabel() ?? null\" [attr.aria-labelledby]=\"ariaLabel() ? null : (ariaLabelledby() ?? id)\" (mousedown)=\"$event.preventDefault()\">\n @for (group of groups(); track $index) {\n <li role=\"presentation\">\n <ul class=\"su-select-group\" [attr.role]=\"group.label ? 'group' : 'presentation'\" [attr.aria-labelledby]=\"group.label ? id + '-group-' + $index : null\">\n @if (group.label) {\n <li role=\"presentation\" class=\"su-select-group-label\" [id]=\"id + '-group-' + $index\">{{ group.label }}</li>\n }\n @for (item of group.options; track item.index) {\n <!-- eslint-disable-next-line @angular-eslint/template/click-events-have-key-events, @angular-eslint/template/interactive-supports-focus -- the combobox handles the keyboard through aria-activedescendant -->\n <li\n role=\"option\"\n class=\"su-select-option\"\n [id]=\"optionId(item.index)\"\n [class.su-select-active]=\"item.index === state().active\"\n [attr.aria-selected]=\"isSelected(item.option)\"\n [attr.aria-disabled]=\"item.option.disabled ? true : null\"\n (click)=\"choose(item.index)\"\n (pointermove)=\"activate(item.index)\">\n <span class=\"su-select-option-label\">{{ item.option.label }}</span>\n <svg class=\"su-select-check\" viewBox=\"0 0 24 24\" aria-hidden=\"true\"><path d=\"M5 12.5l4.5 4.5L19 7.5\" /></svg>\n </li>\n }\n </ul>\n </li>\n } @empty {\n <li role=\"presentation\" class=\"su-select-empty\">{{ texts().empty }}</li>\n }\n </ul>\n</div>\n", styles: [":host{display:inline-block;max-width:100%;vertical-align:middle}.su-select-trigger{align-items:center;background:var(--su-select-background, #fff);border:var(--su-select-border, 1px solid #d1d5db);border-radius:var(--su-select-radius, .375rem);box-sizing:border-box;color:var(--su-select-color, #111827);cursor:pointer;display:inline-flex;font:inherit;font-size:var(--su-select-font-size, .875rem);gap:.5rem;justify-content:space-between;line-height:1.4;max-width:100%;min-height:var(--su-select-height, 2.25rem);min-width:var(--su-select-min-width, 8rem);padding:var(--su-select-padding, .375rem .625rem);text-align:start;transition:border-color .15s,box-shadow .15s;width:100%}.su-select-trigger:hover:not(:disabled){border-color:var(--su-select-hover-border-color, #9ca3af)}.su-select-trigger:focus-visible{box-shadow:var(--su-select-focus-ring, 0 0 0 3px rgba(37, 99, 235, .35));outline:none}.su-select-trigger:disabled{cursor:not-allowed;opacity:var(--su-select-disabled-opacity, .5)}.su-select-value{overflow:hidden;text-overflow:ellipsis;white-space:nowrap}.su-select-placeholder{color:var(--su-select-muted-color, #6b7280)}.su-select-chevron,.su-select-check{fill:none;flex:none;stroke:currentColor;stroke-linecap:round;stroke-linejoin:round;stroke-width:2}.su-select-chevron{block-size:1rem;color:var(--su-select-muted-color, #6b7280);inline-size:1rem;transition:transform .2s}:host(.su-select-open) .su-select-chevron{transform:rotate(180deg)}.su-select-panel{background:var(--su-select-list-background, var(--su-select-background, #fff));border:var(--su-select-list-border, var(--su-select-border, 1px solid #d1d5db));border-radius:var(--su-select-list-radius, .5rem);box-shadow:var(--su-select-list-shadow, 0 10px 30px rgba(0, 0, 0, .12));box-sizing:border-box;color:var(--su-select-color, #111827);display:none;flex-direction:column;font-family:inherit;font-size:var(--su-select-font-size, .875rem);inset:auto;margin:0;max-height:min(var(--su-select-list-max-height, 18rem),100vh - 16px);max-width:calc(100vw - 16px);overflow:hidden;padding:var(--su-select-list-padding, .25rem);position:fixed;z-index:var(--su-select-z-index, 1000)}.su-select-panel.su-select-shown{display:flex}.su-select-panel.su-select-animated.su-select-shown{animation:su-select-in var(--su-select-duration, .16s) cubic-bezier(.16,1,.3,1);transform-origin:top}.su-select-panel.su-select-animated.su-select-shown[data-side=top]{animation-name:su-select-in-above;transform-origin:bottom}.su-select-search{background:transparent;border:0;border-bottom:var(--su-select-search-border, 1px solid #e5e7eb);box-sizing:border-box;color:inherit;flex:none;font:inherit;margin-bottom:.25rem;outline:none;padding:.4rem .5rem;width:100%}.su-select-search::placeholder{color:var(--su-select-muted-color, #6b7280)}.su-select-list,.su-select-group{list-style:none;margin:0;padding:0}.su-select-list{outline:none;overflow-y:auto;overscroll-behavior:contain}.su-select-group-label{color:var(--su-select-muted-color, #6b7280);font-size:.75em;letter-spacing:.04em;padding:.5rem .5rem .2rem;text-transform:uppercase}.su-select-option{align-items:center;border-radius:var(--su-select-option-radius, .3125rem);cursor:pointer;display:flex;gap:1rem;justify-content:space-between;padding:var(--su-select-option-padding, .4rem .5rem);white-space:nowrap}.su-select-option.su-select-active{background:var(--su-select-option-active-background, #f3f4f6)}.su-select-option[aria-selected=true]{color:var(--su-select-option-selected-color, inherit);font-weight:var(--su-select-option-selected-weight, 600)}.su-select-option[aria-disabled=true]{cursor:not-allowed;opacity:var(--su-select-disabled-opacity, .5)}.su-select-check{block-size:1rem;inline-size:1rem;visibility:hidden}[aria-selected=true]>.su-select-check{visibility:visible}.su-select-empty{color:var(--su-select-muted-color, #6b7280);padding:var(--su-select-option-padding, .4rem .5rem)}@keyframes su-select-in{0%{opacity:0;transform:translateY(-4px) scaleY(.96)}}@keyframes su-select-in-above{0%{opacity:0;transform:translateY(4px) scaleY(.96)}}@media(prefers-reduced-motion:reduce){.su-select-panel.su-select-shown,.su-select-panel.su-select-shown[data-side=top]{animation:none}.su-select-chevron{transition:none}}\n"] }]
296
+ }], ctorParameters: () => [] });
297
+ function isPrintable(event) {
298
+ return event.key.length === 1 && event.key !== ' ' && !event.altKey;
299
+ }
300
+
301
+ /**
302
+ * Generated bundle index. Do not edit.
303
+ */
304
+
305
+ export { SuSelectComponent };
306
+ //# sourceMappingURL=su-labs-select.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"su-labs-select.mjs","sources":["../../../../compat/angular-19/build/select/src/lib/select/select.component.ts","../../../../compat/angular-19/build/select/src/lib/select/select.component.html","../../../../compat/angular-19/build/select/src/su-labs-select.ts"],"sourcesContent":["import { DOCUMENT } from '@angular/common';\nimport { afterRenderEffect, booleanAttribute, ChangeDetectionStrategy, Component, computed, DestroyRef, effect, ElementRef, inject, input, model, output, signal, untracked, viewChild } from '@angular/core';\nimport { SU_SELECT_LABELS, SuSelectController, suSelectGroups, SuSelectLabels, SuSelectMove, SuSelectOption } from '@su-labs/core/select';\nimport { suTooltipPosition } from '@su-labs/core/tooltip';\n\nlet nextSelectId = 0;\n\nconst MOVES: Readonly<Record<string, SuSelectMove>> = {\n ArrowDown: 'next',\n ArrowUp: 'previous',\n Home: 'first',\n End: 'last',\n PageDown: 'last',\n PageUp: 'first',\n};\n\n/**\n * A select over `SuSelectController` from `@su-labs/core/select`, with its own styled list instead of the browser's\n * popup: `<su-lib-select [options]=\"sizes\" [(value)]=\"size\" />`. The trigger is a `combobox` button and the list a\n * `listbox` in the top layer (`popover`), placed below the trigger or above it when there's no room. It follows the\n * WAI-ARIA select-only combobox pattern: arrows, Home and End, type-ahead, Enter or Space to choose, Escape to close\n * and Tab to choose and move on. With `searchable`, a search field at the top of the list filters the options.\n */\n@Component({\n selector: 'su-lib-select',\n changeDetection: ChangeDetectionStrategy.OnPush,\n templateUrl: './select.component.html',\n styleUrl: './select.component.scss',\n host: {\n class: 'su-select',\n '[class.su-select-open]': 'open()',\n '[class.su-select-disabled]': 'disabled()',\n '(focusout)': 'onFocusOut($event)',\n },\n})\nexport class SuSelectComponent<T> {\n /** The choices: `{ value, label, disabled?, group? }`; options sharing a `group` should follow one another */\n readonly options = input<readonly SuSelectOption<T>[]>([]);\n /** The chosen value, or `null` while nothing is chosen */\n readonly value = model<T | null>(null);\n /** Whether the list is open; setting it opens or closes it */\n readonly open = model(false);\n /** Set once focus has left the select, for forms that show errors after the user moved on */\n readonly touched = model(false);\n /** A search field at the top of the list that filters the options @default false */\n readonly searchable = input(false, { transform: booleanAttribute });\n /** Can't be opened or focused @default false */\n readonly disabled = input(false, { transform: booleanAttribute });\n /** Opens with a short fade and slide; off when the user prefers less motion @default true */\n readonly animated = input(true, { transform: booleanAttribute });\n /** Shown while nothing is chosen @default labels.placeholder */\n readonly placeholder = input<string>();\n /** The select's name for screen readers, when no `<label>` wraps it and no `ariaLabelledby` names it */\n readonly ariaLabel = input<string>();\n /** The id of the element that names the select */\n readonly ariaLabelledby = input<string>();\n /** Texts to replace, e.g. in the page's language */\n readonly labels = input<Partial<SuSelectLabels>>({});\n /** The user chose an option (never emitted for a value set from outside): its value */\n readonly chosen = output<T>();\n\n protected readonly id = `su-select-${nextSelectId++}`;\n protected readonly listId = `${this.id}-list`;\n protected readonly texts = computed<SuSelectLabels>(() => ({\n ...SU_SELECT_LABELS,\n ...this.labels(),\n }));\n\n private readonly controller = new SuSelectController<T>();\n protected readonly state = signal(this.controller.state.get());\n protected readonly groups = computed(() =>\n suSelectGroups(this.state().visible)\n );\n protected readonly selected = computed(() => {\n this.state();\n return this.controller.selected;\n });\n protected readonly activeId = computed(() => {\n const { open, active } = this.state();\n return open && active >= 0 ? this.optionId(active) : null;\n });\n\n private readonly host: ElementRef<HTMLElement> = inject(ElementRef);\n private readonly document = inject(DOCUMENT);\n private readonly trigger =\n viewChild.required<ElementRef<HTMLButtonElement>>('trigger');\n private readonly panel = viewChild.required<ElementRef<HTMLElement>>('panel');\n private readonly search = viewChild<ElementRef<HTMLInputElement>>('search');\n\n constructor() {\n let previous = this.controller.state.get();\n const unsubscribe = this.controller.state.subscribe(state => {\n this.state.set(state);\n if (state.value !== previous.value) {\n this.value.set(state.value);\n }\n if (state.open !== previous.open) {\n this.open.set(state.open);\n }\n previous = state;\n });\n inject(DestroyRef).onDestroy(unsubscribe);\n\n effect(() => {\n const options = this.options();\n untracked(() => this.controller.setOptions(options));\n });\n\n effect(() => {\n const value = this.value();\n untracked(() => this.controller.setValue(value));\n });\n\n effect(() => {\n const open = this.open() && !this.disabled();\n untracked(() =>\n open ? this.controller.open() : this.controller.close()\n );\n });\n\n effect(onCleanup => {\n if (!this.state().open) {\n return;\n }\n const onPointerDown = (event: PointerEvent) =>\n this.onDocumentPointerDown(event);\n const onMove = () => this.follow();\n const view = this.document.defaultView;\n this.document.addEventListener('pointerdown', onPointerDown);\n view?.addEventListener('scroll', onMove, true);\n view?.addEventListener('resize', onMove);\n onCleanup(() => {\n this.document.removeEventListener('pointerdown', onPointerDown);\n view?.removeEventListener('scroll', onMove, true);\n view?.removeEventListener('resize', onMove);\n });\n });\n\n afterRenderEffect(() => {\n const open = this.state().open;\n untracked(() => (open ? this.reveal() : this.conceal()));\n });\n\n afterRenderEffect(() => {\n const id = this.activeId();\n const option = id ? this.document.getElementById(id) : null;\n if (option && typeof option.scrollIntoView === 'function') {\n option.scrollIntoView({ block: 'nearest' });\n }\n });\n }\n\n /** Moves focus to the trigger */\n focus(): void {\n this.trigger().nativeElement.focus();\n }\n\n protected optionId(index: number): string {\n return `${this.id}-option-${index}`;\n }\n\n protected isSelected(option: SuSelectOption<T>): boolean {\n return option === this.selected();\n }\n\n protected toggle(): void {\n if (!this.disabled()) {\n this.controller.toggle();\n }\n }\n\n protected choose(index: number): void {\n this.byUser(() => this.pick(index));\n }\n\n protected activate(index: number): void {\n if (index !== this.state().active) {\n this.controller.activate(index);\n }\n }\n\n protected onSearch(event: Event): void {\n if (event.target instanceof HTMLInputElement) {\n this.controller.search(event.target.value);\n }\n }\n\n protected onKeydown(event: KeyboardEvent): void {\n if (this.disabled() || event.ctrlKey || event.metaKey) {\n return;\n }\n this.byUser(() =>\n this.state().open\n ? this.onOpenKeydown(event)\n : this.onClosedKeydown(event)\n );\n }\n\n protected onFocusOut(event: FocusEvent): void {\n const next = event.relatedTarget;\n if (next instanceof Node && this.host.nativeElement.contains(next)) {\n return;\n }\n this.controller.close();\n this.touched.set(true);\n }\n\n private onClosedKeydown(event: KeyboardEvent): void {\n const move = MOVES[event.key];\n if (move || event.key === 'Enter' || event.key === ' ') {\n event.preventDefault();\n this.controller.open();\n if (move === 'first' || move === 'last') {\n this.controller.move(move);\n }\n return;\n }\n if (isPrintable(event)) {\n event.preventDefault();\n this.controller.typeAhead(event.key);\n }\n }\n\n private onOpenKeydown(event: KeyboardEvent): void {\n const searching = this.searchable();\n const move = MOVES[event.key];\n if (event.key === 'ArrowUp' && event.altKey) {\n event.preventDefault();\n this.pick(this.state().active);\n } else if (\n move &&\n !(searching && (event.key === 'Home' || event.key === 'End'))\n ) {\n event.preventDefault();\n this.controller.move(move);\n } else if (event.key === 'Enter' || (event.key === ' ' && !searching)) {\n event.preventDefault();\n this.pick(this.state().active);\n } else if (event.key === 'Escape') {\n event.preventDefault();\n event.stopPropagation();\n this.controller.close();\n this.focus();\n } else if (event.key === 'Tab') {\n this.controller.choose();\n this.controller.close();\n } else if (!searching && isPrintable(event)) {\n event.preventDefault();\n this.controller.typeAhead(event.key);\n }\n }\n\n private pick(index: number): void {\n if (this.controller.choose(index)) {\n this.focus();\n }\n }\n\n private byUser(action: () => void): void {\n const before = this.controller.state.get().value;\n action();\n const after = this.controller.state.get().value;\n if (after !== null && after !== before) {\n this.chosen.emit(after);\n }\n }\n\n private onDocumentPointerDown(event: PointerEvent): void {\n const target = event.target;\n if (\n !(target instanceof Node) ||\n !this.host.nativeElement.contains(target)\n ) {\n this.controller.close();\n }\n }\n\n private reveal(): void {\n const panel = this.panel().nativeElement;\n panel.classList.add('su-select-shown');\n if (\n typeof panel.showPopover === 'function' &&\n !panel.matches(':popover-open')\n ) {\n panel.showPopover();\n }\n this.place();\n const search = this.search()?.nativeElement;\n if (search) {\n search.value = '';\n search.focus();\n }\n }\n\n private conceal(): void {\n const panel = this.panel().nativeElement;\n panel.classList.remove('su-select-shown');\n if (\n typeof panel.hidePopover === 'function' &&\n panel.matches(':popover-open')\n ) {\n panel.hidePopover();\n }\n }\n\n private follow(): void {\n const trigger = this.trigger().nativeElement.getBoundingClientRect();\n const height = this.document.defaultView?.innerHeight ?? 0;\n if (trigger.bottom <= 0 || trigger.top >= height) {\n this.controller.close();\n return;\n }\n this.place();\n }\n\n private place(): void {\n if (!this.state().open) {\n return;\n }\n const panel = this.panel().nativeElement;\n const trigger = this.trigger().nativeElement.getBoundingClientRect();\n const view = this.document.defaultView;\n panel.style.minWidth = `${trigger.width}px`;\n const position = suTooltipPosition(\n trigger,\n { width: panel.offsetWidth, height: panel.offsetHeight },\n {\n placement: 'bottom-start',\n offset: 4,\n viewport: {\n width: this.document.documentElement.clientWidth,\n height: view?.innerHeight ?? 0,\n },\n rtl:\n view?.getComputedStyle(this.host.nativeElement).direction === 'rtl',\n }\n );\n panel.dataset['side'] = position.side;\n panel.style.left = `${position.x}px`;\n panel.style.top = `${position.y}px`;\n }\n}\n\nfunction isPrintable(event: KeyboardEvent): boolean {\n return event.key.length === 1 && event.key !== ' ' && !event.altKey;\n}\n","<button\n #trigger\n type=\"button\"\n class=\"su-select-trigger\"\n role=\"combobox\"\n aria-haspopup=\"listbox\"\n [id]=\"id\"\n [disabled]=\"disabled()\"\n [attr.aria-expanded]=\"state().open\"\n [attr.aria-controls]=\"listId\"\n [attr.aria-activedescendant]=\"searchable() ? null : activeId()\"\n [attr.aria-label]=\"ariaLabel() ?? null\"\n [attr.aria-labelledby]=\"ariaLabelledby() ?? null\"\n (click)=\"toggle()\"\n (keydown)=\"onKeydown($event)\">\n <span class=\"su-select-value\" [class.su-select-placeholder]=\"!selected()\">{{ selected()?.label ?? placeholder() ?? texts().placeholder }}</span>\n <svg class=\"su-select-chevron\" viewBox=\"0 0 24 24\" aria-hidden=\"true\"><path d=\"m6 9 6 6 6-6\" /></svg>\n</button>\n<div #panel popover=\"manual\" class=\"su-select-panel\" [class.su-select-animated]=\"animated()\">\n @if (searchable()) {\n <input\n #search\n type=\"text\"\n class=\"su-select-search\"\n role=\"combobox\"\n autocomplete=\"off\"\n spellcheck=\"false\"\n aria-autocomplete=\"list\"\n aria-expanded=\"true\"\n [attr.aria-controls]=\"listId\"\n [attr.aria-activedescendant]=\"activeId()\"\n [attr.aria-label]=\"texts().search\"\n [placeholder]=\"texts().search\"\n (input)=\"onSearch($event)\"\n (keydown)=\"onKeydown($event)\" />\n }\n <ul class=\"su-select-list\" role=\"listbox\" tabindex=\"-1\" [id]=\"listId\" [attr.aria-label]=\"ariaLabel() ?? null\" [attr.aria-labelledby]=\"ariaLabel() ? null : (ariaLabelledby() ?? id)\" (mousedown)=\"$event.preventDefault()\">\n @for (group of groups(); track $index) {\n <li role=\"presentation\">\n <ul class=\"su-select-group\" [attr.role]=\"group.label ? 'group' : 'presentation'\" [attr.aria-labelledby]=\"group.label ? id + '-group-' + $index : null\">\n @if (group.label) {\n <li role=\"presentation\" class=\"su-select-group-label\" [id]=\"id + '-group-' + $index\">{{ group.label }}</li>\n }\n @for (item of group.options; track item.index) {\n <!-- eslint-disable-next-line @angular-eslint/template/click-events-have-key-events, @angular-eslint/template/interactive-supports-focus -- the combobox handles the keyboard through aria-activedescendant -->\n <li\n role=\"option\"\n class=\"su-select-option\"\n [id]=\"optionId(item.index)\"\n [class.su-select-active]=\"item.index === state().active\"\n [attr.aria-selected]=\"isSelected(item.option)\"\n [attr.aria-disabled]=\"item.option.disabled ? true : null\"\n (click)=\"choose(item.index)\"\n (pointermove)=\"activate(item.index)\">\n <span class=\"su-select-option-label\">{{ item.option.label }}</span>\n <svg class=\"su-select-check\" viewBox=\"0 0 24 24\" aria-hidden=\"true\"><path d=\"M5 12.5l4.5 4.5L19 7.5\" /></svg>\n </li>\n }\n </ul>\n </li>\n } @empty {\n <li role=\"presentation\" class=\"su-select-empty\">{{ texts().empty }}</li>\n }\n </ul>\n</div>\n","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './public-api';\n"],"names":[],"mappings":";;;;;;AAKA,IAAI,YAAY,GAAG,CAAC;AAEpB,MAAM,KAAK,GAA2C;AACpD,IAAA,SAAS,EAAE,MAAM;AACjB,IAA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jTW,iBAAiB,EAAA,IAAA,EAAA,EAAA,EAAA,MAAA,EAAA,EAAA,CAAA,eAAA,CAAA,SAAA,EAAA,CAAA;AAAjB,IAAA,OAAA,IAAA,GAAA,EAAA,CAAA,oBAAA,CAAA,EAAA,UAAA,EAAA,QAAA,EAAA,OAAA,EAAA,SAAA,EAAA,IAAA,EAAA,iBAAiB,kjECnC9B,wkGAiEA,EAAA,MAAA,EAAA,CAAA,uoIAAA,CAAA,EAAA,eAAA,EAAA,EAAA,CAAA,uBAAA,CAAA,MAAA,EAAA,CAAA;;4FD9Ba,iBAAiB,EAAA,UAAA,EAAA,CAAA;kBAZ7B,SAAS;AACE,YAAA,IAAA,EAAA,CAAA,EAAA,QAAA,EAAA,eAAe,EAAA,eAAA,EACR,uBAAuB,CAAC,MAAM,EAAA,IAAA,EAGzC;AACJ,wBAAA,KAAK,EAAE,WAAW;AAClB,wBAAA,wBAAwB,EAAE,QAAQ;AAClC,wBAAA,4BAA4B,EAAE,YAAY;AAC1C,wBAAA,YAAY,EAAE,oBAAoB;AACnC,qBAAA,EAAA,QAAA,EAAA,wkGAAA,EAAA,MAAA,EAAA,CAAA,uoIAAA,CAAA,EAAA;;AAsTH,SAAS,WAAW,CAAC,KAAoB,EAAA;AACvC,IAAA,OAAO,KAAK,CAAC,GAAG,CAAC,MAAM,KAAK,CAAC,IAAI,KAAK,CAAC,GAAG,KAAK,GAAG,IAAI,CAAC,KAAK,CAAC,MAAM;AACrE;;AEzVA;;AAEG;;;;"}
package/index.d.ts ADDED
@@ -0,0 +1,5 @@
1
+ /**
2
+ * Generated bundle index. Do not edit.
3
+ */
4
+ /// <amd-module name="@su-labs/select" />
5
+ export * from './public-api';
@@ -0,0 +1,70 @@
1
+ import { SuSelectLabels, SuSelectOption } from '@su-labs/core/select';
2
+ import * as i0 from "@angular/core";
3
+ /**
4
+ * A select over `SuSelectController` from `@su-labs/core/select`, with its own styled list instead of the browser's
5
+ * popup: `<su-lib-select [options]="sizes" [(value)]="size" />`. The trigger is a `combobox` button and the list a
6
+ * `listbox` in the top layer (`popover`), placed below the trigger or above it when there's no room. It follows the
7
+ * WAI-ARIA select-only combobox pattern: arrows, Home and End, type-ahead, Enter or Space to choose, Escape to close
8
+ * and Tab to choose and move on. With `searchable`, a search field at the top of the list filters the options.
9
+ */
10
+ export declare class SuSelectComponent<T> {
11
+ /** The choices: `{ value, label, disabled?, group? }`; options sharing a `group` should follow one another */
12
+ readonly options: import("@angular/core").InputSignal<readonly SuSelectOption<T>[]>;
13
+ /** The chosen value, or `null` while nothing is chosen */
14
+ readonly value: import("@angular/core").ModelSignal<T | null>;
15
+ /** Whether the list is open; setting it opens or closes it */
16
+ readonly open: import("@angular/core").ModelSignal<boolean>;
17
+ /** Set once focus has left the select, for forms that show errors after the user moved on */
18
+ readonly touched: import("@angular/core").ModelSignal<boolean>;
19
+ /** A search field at the top of the list that filters the options @default false */
20
+ readonly searchable: import("@angular/core").InputSignalWithTransform<boolean, unknown>;
21
+ /** Can't be opened or focused @default false */
22
+ readonly disabled: import("@angular/core").InputSignalWithTransform<boolean, unknown>;
23
+ /** Opens with a short fade and slide; off when the user prefers less motion @default true */
24
+ readonly animated: import("@angular/core").InputSignalWithTransform<boolean, unknown>;
25
+ /** Shown while nothing is chosen @default labels.placeholder */
26
+ readonly placeholder: import("@angular/core").InputSignal<string | undefined>;
27
+ /** The select's name for screen readers, when no `<label>` wraps it and no `ariaLabelledby` names it */
28
+ readonly ariaLabel: import("@angular/core").InputSignal<string | undefined>;
29
+ /** The id of the element that names the select */
30
+ readonly ariaLabelledby: import("@angular/core").InputSignal<string | undefined>;
31
+ /** Texts to replace, e.g. in the page's language */
32
+ readonly labels: import("@angular/core").InputSignal<Partial<SuSelectLabels>>;
33
+ /** The user chose an option (never emitted for a value set from outside): its value */
34
+ readonly chosen: import("@angular/core").OutputEmitterRef<T>;
35
+ protected readonly id: string;
36
+ protected readonly listId: string;
37
+ protected readonly texts: import("@angular/core").Signal<SuSelectLabels>;
38
+ private readonly controller;
39
+ protected readonly state: import("@angular/core").WritableSignal<import("@su-labs/core/select").SuSelectState<T>>;
40
+ protected readonly groups: import("@angular/core").Signal<readonly import("@su-labs/core/select").SuSelectGroup<T>[]>;
41
+ protected readonly selected: import("@angular/core").Signal<SuSelectOption<T> | undefined>;
42
+ protected readonly activeId: import("@angular/core").Signal<string | null>;
43
+ private readonly host;
44
+ private readonly document;
45
+ private readonly trigger;
46
+ private readonly panel;
47
+ private readonly search;
48
+ constructor();
49
+ /** Moves focus to the trigger */
50
+ focus(): void;
51
+ protected optionId(index: number): string;
52
+ protected isSelected(option: SuSelectOption<T>): boolean;
53
+ protected toggle(): void;
54
+ protected choose(index: number): void;
55
+ protected activate(index: number): void;
56
+ protected onSearch(event: Event): void;
57
+ protected onKeydown(event: KeyboardEvent): void;
58
+ protected onFocusOut(event: FocusEvent): void;
59
+ private onClosedKeydown;
60
+ private onOpenKeydown;
61
+ private pick;
62
+ private byUser;
63
+ private onDocumentPointerDown;
64
+ private reveal;
65
+ private conceal;
66
+ private follow;
67
+ private place;
68
+ static ɵfac: i0.ɵɵFactoryDeclaration<SuSelectComponent<any>, never>;
69
+ static ɵcmp: i0.ɵɵComponentDeclaration<SuSelectComponent<any>, "su-lib-select", never, { "options": { "alias": "options"; "required": false; "isSignal": true; }; "value": { "alias": "value"; "required": false; "isSignal": true; }; "open": { "alias": "open"; "required": false; "isSignal": true; }; "touched": { "alias": "touched"; "required": false; "isSignal": true; }; "searchable": { "alias": "searchable"; "required": false; "isSignal": true; }; "disabled": { "alias": "disabled"; "required": false; "isSignal": true; }; "animated": { "alias": "animated"; "required": false; "isSignal": true; }; "placeholder": { "alias": "placeholder"; "required": false; "isSignal": true; }; "ariaLabel": { "alias": "ariaLabel"; "required": false; "isSignal": true; }; "ariaLabelledby": { "alias": "ariaLabelledby"; "required": false; "isSignal": true; }; "labels": { "alias": "labels"; "required": false; "isSignal": true; }; }, { "value": "valueChange"; "open": "openChange"; "touched": "touchedChange"; "chosen": "chosen"; }, never, never, true, never>;
70
+ }
package/package.json CHANGED
@@ -1,6 +1,53 @@
1
1
  {
2
2
  "name": "@su-labs/select",
3
- "version": "0.0.0-stage",
4
- "stub": true,
5
- "description": "Temporary package placeholder for staged publishing"
3
+ "version": "19.0.0",
4
+ "description": "An accessible Angular select with its own styled list instead of the native popup: search, groups, disabled options, full keyboard support and type-ahead, opening in the top layer and flipping above when there is no room, themeable with CSS variables.",
5
+ "keywords": [
6
+ "angular",
7
+ "select",
8
+ "dropdown",
9
+ "listbox",
10
+ "combobox",
11
+ "searchable-select",
12
+ "autocomplete",
13
+ "accessible",
14
+ "signals",
15
+ "themeable",
16
+ "css-variables"
17
+ ],
18
+ "author": {
19
+ "name": "Yevheniy Alekseyev",
20
+ "email": "yev.alekseyev@gmail.com",
21
+ "url": "https://github.com/Greezaaa"
22
+ },
23
+ "repository": {
24
+ "type": "git",
25
+ "url": "git+https://github.com/Greezaaa/settings-utils-lib.git",
26
+ "directory": "projects/su-labs/select"
27
+ },
28
+ "homepage": "https://su-labs.dev/select/",
29
+ "bugs": {
30
+ "url": "https://github.com/Greezaaa/settings-utils-lib/issues"
31
+ },
32
+ "peerDependencies": {
33
+ "@angular/common": "^19.0.0",
34
+ "@angular/core": "^19.0.0"
35
+ },
36
+ "dependencies": {
37
+ "@su-labs/core": "1.13.0",
38
+ "tslib": "^2.3.0"
39
+ },
40
+ "sideEffects": false,
41
+ "license": "MIT",
42
+ "module": "fesm2022/su-labs-select.mjs",
43
+ "typings": "index.d.ts",
44
+ "exports": {
45
+ "./package.json": {
46
+ "default": "./package.json"
47
+ },
48
+ ".": {
49
+ "types": "./index.d.ts",
50
+ "default": "./fesm2022/su-labs-select.mjs"
51
+ }
52
+ }
6
53
  }
@@ -0,0 +1 @@
1
+ export * from './lib/select/select.component';