tyrell-components 1.0.0-TC58 → 1.0.0-TC60
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 +1 -1
- package/css/tyrell-colors-static.css +14 -0
- package/css/tyrell-theme.css +6 -5
- package/css/tyrell.css +8 -6
- package/dist/tyrell-colors-static.css +1 -1
- package/dist/tyrell-theme.css +1 -1
- package/dist/tyrell.js +1 -1
- package/lib/base/ty-component.d.ts +13 -12
- package/lib/base/ty-component.js +56 -21
- package/lib/components/button.d.ts +10 -0
- package/lib/components/button.js +22 -1
- package/lib/components/calendar-month.d.ts +7 -1
- package/lib/components/calendar-month.js +32 -18
- package/lib/components/calendar-navigation.js +19 -6
- package/lib/components/calendar.d.ts +25 -5
- package/lib/components/calendar.js +87 -37
- package/lib/components/checkbox.d.ts +5 -0
- package/lib/components/checkbox.js +18 -5
- package/lib/components/copy.d.ts +2 -0
- package/lib/components/copy.js +15 -31
- package/lib/components/date-picker.d.ts +7 -26
- package/lib/components/date-picker.js +14 -84
- package/lib/components/file-upload.js +6 -2
- package/lib/components/input.d.ts +0 -9
- package/lib/components/input.js +18 -40
- package/lib/components/modal.js +59 -18
- package/lib/components/option.d.ts +19 -0
- package/lib/components/option.js +38 -26
- package/lib/components/popup.js +56 -5
- package/lib/components/radio.d.ts +6 -0
- package/lib/components/radio.js +12 -28
- package/lib/components/select.d.ts +132 -194
- package/lib/components/select.js +436 -836
- package/lib/components/selected-tags.d.ts +8 -4
- package/lib/components/selected-tags.js +26 -8
- package/lib/components/switch.d.ts +4 -0
- package/lib/components/switch.js +18 -5
- package/lib/components/tabs.js +1 -1
- package/lib/components/textarea.d.ts +1 -0
- package/lib/components/textarea.js +21 -8
- package/lib/index.d.ts +1 -0
- package/lib/index.js +1 -0
- package/lib/styles/button.js +1 -0
- package/lib/styles/calendar-month.js +1 -1
- package/lib/styles/calendar.js +3 -0
- package/lib/styles/checkbox.js +11 -5
- package/lib/styles/date-picker.js +5 -10
- package/lib/styles/input.js +5 -9
- package/lib/styles/option.d.ts +1 -1
- package/lib/styles/option.js +6 -7
- package/lib/styles/popup.d.ts +1 -1
- package/lib/styles/popup.js +2 -0
- package/lib/styles/radio.js +10 -4
- package/lib/styles/select-base.js +6 -70
- package/lib/styles/select.d.ts +1 -1
- package/lib/styles/select.js +13 -2
- package/lib/styles/switch.js +10 -5
- package/lib/styles/tag.js +2 -1
- package/lib/types/common.d.ts +3 -1
- package/lib/utils/calendar-utils.d.ts +49 -0
- package/lib/utils/calendar-utils.js +63 -6
- package/lib/utils/property-manager.d.ts +0 -5
- package/lib/utils/property-manager.js +0 -11
- package/lib/utils/scroll-lock.d.ts +10 -4
- package/lib/utils/scroll-lock.js +102 -2
- package/lib/utils/validity.d.ts +27 -1
- package/lib/utils/validity.js +68 -16
- package/lib/version.d.ts +1 -1
- package/lib/version.js +1 -1
- package/package.json +1 -1
- package/dist/tyrell.js.map +0 -1
- package/lib/utils/error-flavor.d.ts +0 -8
- package/lib/utils/error-flavor.js +0 -1
|
@@ -3,6 +3,14 @@
|
|
|
3
3
|
* Cardinality follows native <select>: default single (scalar value, picking closes
|
|
4
4
|
* the popup), `multiple` toggles options and submits repeated `name=` FormData entries.
|
|
5
5
|
* Skins: default form field, `compact` content-hugging trigger, slot="trigger" custom.
|
|
6
|
+
*
|
|
7
|
+
* The selection is the `value` attribute/property, nothing else. Options are a
|
|
8
|
+
* plain list: the select draws their check through `option.checked`, a
|
|
9
|
+
* property, and never writes selection state onto them. A closed single select
|
|
10
|
+
* shows the picked option itself in its trigger (manual slot assignment), so
|
|
11
|
+
* nothing is added to the children a framework renders. `external-selection` hands
|
|
12
|
+
* the selection to the app: it marks the options it holds `selected`, the
|
|
13
|
+
* select reads those marks and reports picks as `change` events.
|
|
6
14
|
*/
|
|
7
15
|
import type { Flavor, Size } from "../types/common.js";
|
|
8
16
|
import { type Placement } from "../utils/positioning.js";
|
|
@@ -18,13 +26,13 @@ interface SelectState {
|
|
|
18
26
|
search: string;
|
|
19
27
|
highlightedIndex: number;
|
|
20
28
|
filteredTags: TagData[];
|
|
21
|
-
selectedValues: string[];
|
|
22
29
|
mode: "desktop" | "mobile";
|
|
23
30
|
}
|
|
24
31
|
/**
|
|
25
32
|
* Ty Select Component
|
|
26
33
|
*/
|
|
27
34
|
export declare class TySelect extends TyComponent<SelectState> {
|
|
35
|
+
protected static slotAssignment: SlotAssignmentMode;
|
|
28
36
|
protected static properties: {
|
|
29
37
|
value: {
|
|
30
38
|
type: "string";
|
|
@@ -87,25 +95,21 @@ export declare class TySelect extends TyComponent<SelectState> {
|
|
|
87
95
|
type: "boolean";
|
|
88
96
|
visual: boolean;
|
|
89
97
|
default: boolean;
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
98
|
+
};
|
|
99
|
+
externalSelection: {
|
|
100
|
+
type: "boolean";
|
|
101
|
+
visual: boolean;
|
|
102
|
+
default: boolean;
|
|
93
103
|
};
|
|
94
104
|
allowCreate: {
|
|
95
105
|
type: "boolean";
|
|
96
106
|
visual: boolean;
|
|
97
107
|
default: boolean;
|
|
98
|
-
aliases: {
|
|
99
|
-
"allow-create": boolean;
|
|
100
|
-
};
|
|
101
108
|
};
|
|
102
109
|
createTransform: {
|
|
103
110
|
type: "string";
|
|
104
111
|
visual: boolean;
|
|
105
112
|
default: string;
|
|
106
|
-
aliases: {
|
|
107
|
-
"create-transform": boolean;
|
|
108
|
-
};
|
|
109
113
|
coerce: (v: any) => "none" | "slug";
|
|
110
114
|
};
|
|
111
115
|
notSearchable: {
|
|
@@ -164,148 +168,92 @@ export declare class TySelect extends TyComponent<SelectState> {
|
|
|
164
168
|
default: string;
|
|
165
169
|
};
|
|
166
170
|
};
|
|
167
|
-
private
|
|
168
|
-
private _multiple;
|
|
169
|
-
private _compact;
|
|
170
|
-
private _placeholder;
|
|
171
|
-
private _label;
|
|
172
|
-
private _disabled;
|
|
173
|
-
private _readonly;
|
|
174
|
-
private _required;
|
|
175
|
-
private _clearable;
|
|
176
|
-
private _externalSearch;
|
|
177
|
-
private _allowCreate;
|
|
178
|
-
private _createTransform;
|
|
179
|
-
private _notSearchable;
|
|
180
|
-
private _loading;
|
|
181
|
-
private _scrollLockId;
|
|
182
|
-
private _size;
|
|
183
|
-
private _availableLabel;
|
|
184
|
-
private _selectedLabel;
|
|
185
|
-
private _noOptionsMessage;
|
|
171
|
+
private readonly _uid;
|
|
186
172
|
private _state;
|
|
187
|
-
private
|
|
188
|
-
private _tagClickHandler;
|
|
189
|
-
private _searchInputHandler;
|
|
190
|
-
private _blockSearchClick;
|
|
173
|
+
private _scrollLockId;
|
|
191
174
|
private _keyboardHandler;
|
|
192
|
-
private _debounce;
|
|
193
175
|
private _searchDebounceTimer;
|
|
194
176
|
private _optionsScrollbar;
|
|
195
177
|
private _childObserver;
|
|
196
|
-
private _selectedClone;
|
|
197
178
|
private _customFlavorSheet;
|
|
198
179
|
private _ariaTrigger;
|
|
180
|
+
private _ariaObserver;
|
|
199
181
|
constructor();
|
|
200
|
-
/** TyComponent
|
|
182
|
+
/** TyComponent renders right after this on the first connect. */
|
|
201
183
|
protected onConnect(): void;
|
|
202
184
|
/** Custom (non-built-in) flavors — see utils/flavor-sheet.ts. */
|
|
203
185
|
private _syncCustomFlavor;
|
|
204
|
-
/**
|
|
205
|
-
* `error` turns a neutral select danger, like ty-input; clearing it puts
|
|
206
|
-
* back exactly the flavor attribute the author had, or none, kept meanwhile
|
|
207
|
-
* in ERROR_FLAVOR. Runs once connected: while the element upgrades, `error`
|
|
208
|
-
* may come before the `flavor` written next to it.
|
|
209
|
-
*/
|
|
210
|
-
private syncErrorFlavor;
|
|
211
186
|
protected onDisconnect(): void;
|
|
212
187
|
/** Handle state synchronization BEFORE render. */
|
|
213
188
|
protected onPropertiesChanged(changes: PropertyChange[]): void;
|
|
214
189
|
/**
|
|
215
|
-
* Toggle the loading visual state on the open popup
|
|
216
|
-
*
|
|
217
|
-
*
|
|
218
|
-
* take effect on the next loading toggle.
|
|
190
|
+
* Toggle the loading visual state on the open popup: a centered spinner in
|
|
191
|
+
* place of the options; the search input stays usable. Reads the loader
|
|
192
|
+
* registry each time, so a newly registered loader shows next time.
|
|
219
193
|
*/
|
|
220
194
|
private applyLoadingState;
|
|
221
195
|
/** Form value: a plain entry for single, FormData with repeated entries for multiple (HTMX standard). */
|
|
222
196
|
protected getFormValue(): FormDataEntryValue | FormData | null;
|
|
223
|
-
/** Focus the trigger: a slotted one, else the field. The host itself isn't focusable. */
|
|
224
|
-
focus(options?: FocusOptions): void;
|
|
225
|
-
private parseValue;
|
|
226
|
-
/** Initialize component state from the value property / pre-selected children. */
|
|
227
|
-
private initializeState;
|
|
228
197
|
/**
|
|
229
|
-
*
|
|
230
|
-
*
|
|
231
|
-
*
|
|
232
|
-
* state (see getSelectedValues()): it seeds initial state, once. After
|
|
233
|
-
* this, `value` rules — flipping an option's `selected` property later
|
|
234
|
-
* does nothing, same as native.
|
|
235
|
-
*
|
|
236
|
-
* Called from initializeState() at connect AND from the child observer:
|
|
237
|
-
* a real HTML parser upgrades a custom element the moment its start tag is
|
|
238
|
-
* seen, BEFORE its children exist — `<ty-select>` connects with zero
|
|
239
|
-
* `<ty-option>` children when it's part of the page's own markup (as
|
|
240
|
-
* opposed to an already-built fragment attached via innerHTML/appendChild,
|
|
241
|
-
* where children exist at connect). Calling this only at connect would
|
|
242
|
-
* silently miss every option parsed after that instant, which is the
|
|
243
|
-
* common case for markup that is literally in the page's initial HTML.
|
|
244
|
-
*
|
|
245
|
-
* Safe to call repeatedly: no-ops once `value` has ever been explicitly
|
|
246
|
-
* set (attribute or property) or state is already non-empty — including
|
|
247
|
-
* after a real `.clear()`, which removes `selected` from every option via
|
|
248
|
-
* syncSelectedTags, so there is nothing left here to (re-)seed from.
|
|
249
|
-
*/
|
|
250
|
-
private resolveDeclarativeSelection;
|
|
251
|
-
/**
|
|
252
|
-
* Get all option elements from the component (ty-option preferred, ty-tag accepted)
|
|
198
|
+
* Focus the trigger: a slotted one, else the field. The host itself isn't
|
|
199
|
+
* focusable. A slotted trigger that can't take focus (a <span>, a disabled
|
|
200
|
+
* button) leaves it to the field.
|
|
253
201
|
*/
|
|
202
|
+
focus(options?: FocusOptions): void;
|
|
203
|
+
private parseValue;
|
|
204
|
+
/** The selection: the `value` property. external-selection holds none. */
|
|
205
|
+
private getSelectedValues;
|
|
254
206
|
private getTagElements;
|
|
255
|
-
private getTagData;
|
|
256
|
-
/**
|
|
257
|
-
* Select an option - attribute only. The option stays in the list with
|
|
258
|
-
* selected styling; chips are rendered out-of-band (ty-selected-options).
|
|
259
|
-
*/
|
|
260
|
-
private selectTag;
|
|
261
207
|
/**
|
|
262
|
-
*
|
|
208
|
+
* The options on offer: all but the ones the author hid (`hidden`, like a
|
|
209
|
+
* native <option hidden>). The search filters these and the keyboard walks
|
|
210
|
+
* them; a hidden option can still be the value.
|
|
263
211
|
*/
|
|
264
|
-
private
|
|
212
|
+
private getOfferedTags;
|
|
213
|
+
private getTagData;
|
|
214
|
+
private findOption;
|
|
215
|
+
/** Draw each option's check from the selection (or, external, the app's marks). */
|
|
216
|
+
private paintOptions;
|
|
265
217
|
/**
|
|
266
|
-
*
|
|
267
|
-
*
|
|
268
|
-
* Reads STATE (`_state.selectedValues`), not the DOM: `value` is the
|
|
269
|
-
* selection, and an option's `selected` attribute is a rendering of it
|
|
270
|
-
* (written by syncSelectedTags below), never the other way round. This
|
|
271
|
-
* matters whenever options don't fully reflect the selection — external
|
|
272
|
-
* search legitimately has a selected value with no matching option
|
|
273
|
-
* present; a DOM scan would report empty and desync .value, `required`
|
|
274
|
-
* validation and the click-toggle logic from what's actually selected.
|
|
218
|
+
* The option the trigger shows: single select, list closed, the picked
|
|
219
|
+
* option — if it is a direct child (only those can be slotted).
|
|
275
220
|
*/
|
|
276
|
-
private
|
|
277
|
-
private syncSelectedTags;
|
|
221
|
+
private shownOption;
|
|
278
222
|
/**
|
|
279
|
-
*
|
|
280
|
-
*
|
|
281
|
-
*
|
|
282
|
-
* startup case. Idempotent; cheap to call from the child MutationObserver
|
|
283
|
-
* on every light-DOM change.
|
|
223
|
+
* Every child goes to the slot it asks for, the rest to the list — except
|
|
224
|
+
* the option the trigger shows. The real node: page CSS styles it, and the
|
|
225
|
+
* children a framework rendered stay exactly its own.
|
|
284
226
|
*/
|
|
285
|
-
private
|
|
286
|
-
/**
|
|
227
|
+
private assignSlots;
|
|
228
|
+
/** What the trigger shows, and where every child is slotted. */
|
|
229
|
+
private syncTrigger;
|
|
230
|
+
/** Set the selection; with `dispatchChange`, also fire `change` (a user action). */
|
|
287
231
|
private updateComponentValue;
|
|
288
|
-
/**
|
|
289
|
-
* Build rich item info for values, read off the matching option elements
|
|
290
|
-
*/
|
|
232
|
+
/** Rich item info for values, read off the matching options. */
|
|
291
233
|
private getSelectedItems;
|
|
292
234
|
private calculatePosition;
|
|
293
235
|
private _setupOptionsScrollbar;
|
|
294
236
|
private _destroyOptionsScrollbar;
|
|
237
|
+
/** Open the popup (desktop dropdown or mobile full-screen dialog). */
|
|
238
|
+
private open;
|
|
239
|
+
private close;
|
|
295
240
|
/**
|
|
296
|
-
*
|
|
297
|
-
*
|
|
298
|
-
* `<dialog>.showModal()` puts the dialog in the top layer with a backdrop, but
|
|
299
|
-
* does NOT prevent the page behind it from scrolling. We use the shared scroll
|
|
300
|
-
* lock utility (overflow:hidden on <html>) to keep wheel/touch scrolling from
|
|
301
|
-
* leaking through to the body — same behavior <ty-dropdown> and <ty-modal>
|
|
302
|
-
* implement.
|
|
241
|
+
* `<dialog>.showModal()` puts the popup in the top layer but does NOT stop
|
|
242
|
+
* the page behind it from scrolling: the shared scroll lock does.
|
|
303
243
|
*/
|
|
244
|
+
private lockPageScroll;
|
|
245
|
+
private unlockPageScroll;
|
|
246
|
+
private setExpanded;
|
|
304
247
|
private openDropdown;
|
|
305
248
|
private closeDropdown;
|
|
306
|
-
/** Open mobile modal — <dialog> handles z-index natively. */
|
|
307
249
|
private openMobileModal;
|
|
308
250
|
private closeMobileModal;
|
|
251
|
+
/**
|
|
252
|
+
* On close: empty the search box and show every option again. With
|
|
253
|
+
* external-search the app filters, so it gets an empty `search` instead
|
|
254
|
+
* (right away, not debounced: its list should be reset before a reopen).
|
|
255
|
+
*/
|
|
256
|
+
private resetSearch;
|
|
309
257
|
private handleStubClick;
|
|
310
258
|
/**
|
|
311
259
|
* .select-clear click — must stop propagation before it bubbles to the
|
|
@@ -313,22 +261,12 @@ export declare class TySelect extends TyComponent<SelectState> {
|
|
|
313
261
|
*/
|
|
314
262
|
private handleClearClick;
|
|
315
263
|
/**
|
|
316
|
-
* Keyboard-open the
|
|
317
|
-
*
|
|
318
|
-
* click events on their own the way they do for real form controls, and
|
|
319
|
-
* without this a keyboard-only user could Tab to the field but never
|
|
320
|
-
* open it. document-level handleKeyboard() only runs once already open
|
|
321
|
-
* (it early-returns on !this._state.open), so this is the other half.
|
|
264
|
+
* Keyboard-open the closed stub: it is a div with tabindex="0", so
|
|
265
|
+
* Enter/Space don't click it. handleKeyboard takes over once open.
|
|
322
266
|
*/
|
|
323
267
|
private handleStubKeydown;
|
|
324
268
|
private handleTagClick;
|
|
325
|
-
/**
|
|
326
|
-
* Select/toggle a tag by element — the part of handleTagClick that has no
|
|
327
|
-
* dependency on a real DOM event, so keyboard/programmatic callers (Enter
|
|
328
|
-
* on a highlighted option, allow-create's exact-match dedup) can call it
|
|
329
|
-
* directly instead of faking an Event object just to satisfy
|
|
330
|
-
* preventDefault()/stopPropagation().
|
|
331
|
-
*/
|
|
269
|
+
/** Pick an option: click, Enter on a highlighted one, allow-create's exact match. */
|
|
332
270
|
private selectByTag;
|
|
333
271
|
/**
|
|
334
272
|
* allow-create: Enter with unmatched search text mints a new option.
|
|
@@ -339,64 +277,82 @@ export declare class TySelect extends TyComponent<SelectState> {
|
|
|
339
277
|
*/
|
|
340
278
|
private tryCreateFromSearch;
|
|
341
279
|
/**
|
|
342
|
-
* Multiple + allow-create: clear the search box and
|
|
343
|
-
*
|
|
344
|
-
* the tags-input pattern.
|
|
280
|
+
* Multiple + allow-create: clear the search box and show the full (now
|
|
281
|
+
* longer) list, so the next tag can be typed right away.
|
|
345
282
|
*/
|
|
346
283
|
private clearSearchAfterCreate;
|
|
347
|
-
private
|
|
284
|
+
private searchInput;
|
|
348
285
|
private handleSearchInput;
|
|
349
286
|
private handleKeyboard;
|
|
350
287
|
/**
|
|
351
|
-
* Next tag index in `direction` (-1/1) that
|
|
352
|
-
* around
|
|
353
|
-
*
|
|
354
|
-
*
|
|
288
|
+
* Next tag index in `direction` (-1/1) that a click would accept, wrapping
|
|
289
|
+
* around: not disabled, and not out of sight (`tags` is the list as it was
|
|
290
|
+
* offered; an option can get `hidden` while open, by a server patch).
|
|
291
|
+
* -1 if there is none.
|
|
355
292
|
*/
|
|
356
293
|
private nextEnabledTagIndex;
|
|
357
294
|
private filterTags;
|
|
295
|
+
/**
|
|
296
|
+
* Search filtering marks the options it leaves out `filtered-out`, never
|
|
297
|
+
* `hidden`: that one is the author's (see getOfferedTags).
|
|
298
|
+
*/
|
|
358
299
|
private updateTagVisibility;
|
|
359
300
|
private updateOptionsVisibility;
|
|
360
301
|
private clearHighlights;
|
|
361
302
|
private highlightTag;
|
|
362
|
-
/**
|
|
303
|
+
/** external-search: fire `search`, after `debounce` ms when set. */
|
|
363
304
|
private dispatchSearchEvent;
|
|
364
305
|
private fireSearchEvent;
|
|
365
306
|
/**
|
|
366
|
-
*
|
|
367
|
-
*
|
|
368
|
-
*
|
|
307
|
+
* Popup lifecycle events. They do NOT bubble, like native <dialog>
|
|
308
|
+
* open/close: a bubbling `close` from a select in a ty-modal would close
|
|
309
|
+
* the modal. On open, external-search also gets an empty `search`, a hook
|
|
310
|
+
* to reset or refetch the list.
|
|
369
311
|
*/
|
|
370
312
|
private fireOpenEvent;
|
|
371
313
|
private fireCloseEvent;
|
|
372
314
|
private dispatchChangeEvent;
|
|
315
|
+
/** One sync of everything the state shows; idempotent. */
|
|
373
316
|
protected render(): void;
|
|
317
|
+
/**
|
|
318
|
+
* The options changed while the list is open (a morph, an external-search
|
|
319
|
+
* swap): filter the new ones by the query (a morph also strips the marks
|
|
320
|
+
* of the old filter), and let the keyboard walk them, not the old ones.
|
|
321
|
+
*/
|
|
322
|
+
private refreshOpenList;
|
|
374
323
|
/**
|
|
375
324
|
* Patch label, required marker and disabled/compact state onto the
|
|
376
|
-
* already-built shadow DOM
|
|
377
|
-
* first render, so without this toggling `required`, `label`, `disabled` or
|
|
378
|
-
* `compact` after connect never showed up.
|
|
325
|
+
* already-built shadow DOM (build() writes the markup once).
|
|
379
326
|
*/
|
|
380
327
|
private syncFieldChrome;
|
|
381
328
|
/**
|
|
382
|
-
*
|
|
383
|
-
*
|
|
384
|
-
*
|
|
385
|
-
*
|
|
386
|
-
*
|
|
387
|
-
*
|
|
329
|
+
* A slotted trigger is what takes focus (focus()), so it carries the error
|
|
330
|
+
* state too. aria-describedby can't reach into our shadow root from the
|
|
331
|
+
* light DOM: the message goes in aria-description instead. The trigger is
|
|
332
|
+
* the author's markup, so a morph can strip these while the error stays:
|
|
333
|
+
* a watch on them puts them back. Writes only on a real change, or the
|
|
334
|
+
* watch would feed itself.
|
|
335
|
+
*/
|
|
336
|
+
private syncTriggerAria;
|
|
337
|
+
/**
|
|
338
|
+
* Reflect constraint validation to the owning <form> via ElementInternals:
|
|
339
|
+
* empty + required => valueMissing, with a native <select>'s message.
|
|
340
|
+
* Disabled fields, and external-selection (the app holds the selection),
|
|
341
|
+
* are barred from it.
|
|
388
342
|
*/
|
|
389
343
|
private updateValidity;
|
|
390
344
|
/**
|
|
391
|
-
*
|
|
392
|
-
*
|
|
345
|
+
* A slotted trigger (slot="trigger") replaces the field chrome. has-trigger
|
|
346
|
+
* on the host sizes it to the trigger (Blink can't parse :has() inside
|
|
347
|
+
* :host()); render() puts it back if a morph strips it.
|
|
348
|
+
*/
|
|
349
|
+
private syncTriggerSlot;
|
|
350
|
+
/**
|
|
351
|
+
* Build the shadow DOM once. Mobile (touch, narrow) gets a full-screen
|
|
352
|
+
* dialog with a selected strip; desktop an anchored dropdown. The mode is
|
|
353
|
+
* fixed here: everything wired below belongs to one of them.
|
|
393
354
|
*/
|
|
394
|
-
private
|
|
395
|
-
private setupEventListeners;
|
|
396
|
-
private buildStubClasses;
|
|
397
|
-
private renderDesktop;
|
|
398
|
-
private renderMobile;
|
|
399
|
-
private setupMobileEventListeners;
|
|
355
|
+
private build;
|
|
400
356
|
/**
|
|
401
357
|
* The dialog was closed by someone else — a ty-modal around this select
|
|
402
358
|
* closes the dialogs still open inside it. Run our own close too, so the
|
|
@@ -407,28 +363,19 @@ export declare class TySelect extends TyComponent<SelectState> {
|
|
|
407
363
|
* reopened since then is open again: both are no-ops.
|
|
408
364
|
*/
|
|
409
365
|
private syncOnOutsideClose;
|
|
410
|
-
private handleMobileStubClick;
|
|
411
|
-
/** Keyboard-open the (closed) mobile stub — see handleStubKeydown for why this is needed. */
|
|
412
|
-
private handleMobileStubKeydown;
|
|
413
|
-
private handleMobileTagClick;
|
|
414
366
|
private updateMobileSelectedState;
|
|
415
|
-
/** "Label (n)" with the count in its own muted span
|
|
416
|
-
sections, and re-reads the label so selected-label/available-label
|
|
417
|
-
changes after first render show up. */
|
|
367
|
+
/** "Label (n)" with the count in its own muted span. */
|
|
418
368
|
private setMobileSectionTitle;
|
|
419
369
|
/**
|
|
420
|
-
* Hand the dialog's spare
|
|
421
|
-
*
|
|
422
|
-
*
|
|
423
|
-
* rather than splitting it. Selecting from the list hands it back to
|
|
424
|
-
* "available" — you're still picking, so that's the list you want open.
|
|
370
|
+
* Hand the dialog's spare height to one section: a phone has no room for
|
|
371
|
+
* two usefully tall lists. Selecting from the list hands it back to
|
|
372
|
+
* "available".
|
|
425
373
|
*/
|
|
426
374
|
private expandMobileSection;
|
|
427
375
|
/**
|
|
428
376
|
* The selected values as dismissible chips, pinned above the available
|
|
429
377
|
* list so a long list can never scroll the current selection out of sight.
|
|
430
|
-
* Rebuilt wholesale: the strip is small
|
|
431
|
-
* track chip identity for the sake of a handful of nodes.
|
|
378
|
+
* Rebuilt wholesale: the strip is small.
|
|
432
379
|
*/
|
|
433
380
|
private renderMobileSelectedChips;
|
|
434
381
|
/**
|
|
@@ -438,39 +385,25 @@ export declare class TySelect extends TyComponent<SelectState> {
|
|
|
438
385
|
* more options than fit without scrolling.
|
|
439
386
|
*/
|
|
440
387
|
private shouldShowSearch;
|
|
441
|
-
/**
|
|
442
|
-
* Toggle the search row (desktop header / mobile input) per shouldShowSearch.
|
|
443
|
-
*/
|
|
388
|
+
/** Toggle the search row (desktop header / mobile input) per shouldShowSearch. */
|
|
444
389
|
private updateSearchVisibility;
|
|
445
390
|
/**
|
|
446
|
-
*
|
|
447
|
-
* - single
|
|
448
|
-
*
|
|
449
|
-
* placeholder when empty
|
|
450
|
-
* - multiple + field: joined labels (ellipsis via CSS), or placeholder
|
|
391
|
+
* The trigger, list closed:
|
|
392
|
+
* - single: the picked option itself (`shown`), else its label, else the placeholder
|
|
393
|
+
* - multiple + field: the labels, comma-joined (ellipsis via CSS)
|
|
451
394
|
* - multiple + compact: placeholder + count badge
|
|
395
|
+
* Open, the list shows what is picked: the trigger shows the placeholder.
|
|
452
396
|
*/
|
|
453
397
|
private updateSelectionDisplay;
|
|
454
398
|
/**
|
|
455
|
-
*
|
|
456
|
-
*
|
|
457
|
-
* an option (getTagElements filters [cloned]) and ty-option's own
|
|
458
|
-
* :host([cloned]) styling strips its list-row chrome.
|
|
459
|
-
*/
|
|
460
|
-
private syncSelectedClone;
|
|
461
|
-
/**
|
|
462
|
-
* Deselect a value programmatically WITH a change event.
|
|
463
|
-
* Used by out-of-band chip displays (ty-selected-options) so dismissing a chip
|
|
464
|
-
* fires change like any in-popup interaction (HTMX hx-trigger="change" etc.).
|
|
399
|
+
* Deselect a value WITH a change event, like a pick in the popup (HTMX
|
|
400
|
+
* hx-trigger="change" etc.). Used by ty-selected-options chips.
|
|
465
401
|
*/
|
|
466
402
|
deselectValue(value: string): void;
|
|
467
403
|
/**
|
|
468
|
-
* Clear the
|
|
469
|
-
*
|
|
470
|
-
*
|
|
471
|
-
* their own clear icon's click handler to it. Shows no validation
|
|
472
|
-
* message (a code reset after a save shouldn't flag the field); the
|
|
473
|
-
* built-in × does.
|
|
404
|
+
* Clear the selection WITH a change event (action: 'clear'), for a custom
|
|
405
|
+
* trigger's own clear control. Shows no validation message (a code reset
|
|
406
|
+
* after a save shouldn't flag the field); the built-in × does.
|
|
474
407
|
*/
|
|
475
408
|
clear(): void;
|
|
476
409
|
get value(): string;
|
|
@@ -501,6 +434,12 @@ export declare class TySelect extends TyComponent<SelectState> {
|
|
|
501
434
|
set notSearchable(value: boolean);
|
|
502
435
|
get externalSearch(): boolean;
|
|
503
436
|
set externalSearch(value: boolean);
|
|
437
|
+
get externalSelection(): boolean;
|
|
438
|
+
set externalSelection(value: boolean);
|
|
439
|
+
get allowCreate(): boolean;
|
|
440
|
+
set allowCreate(value: boolean);
|
|
441
|
+
get createTransform(): "none" | "slug";
|
|
442
|
+
set createTransform(value: "none" | "slug");
|
|
504
443
|
get debounce(): number;
|
|
505
444
|
set debounce(value: number | string);
|
|
506
445
|
get size(): Size;
|
|
@@ -511,7 +450,6 @@ export declare class TySelect extends TyComponent<SelectState> {
|
|
|
511
450
|
set placement(value: Placement | "");
|
|
512
451
|
get flavor(): Flavor;
|
|
513
452
|
set flavor(value: Flavor);
|
|
514
|
-
attributeChangedCallback(name: string, oldValue: string | null, newValue: string | null): void;
|
|
515
453
|
get form(): HTMLFormElement | null;
|
|
516
454
|
}
|
|
517
455
|
export {};
|