@akcelik/strct 1.20.0 → 1.22.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/fesm2022/akcelik-strct.mjs +436 -57
- package/fesm2022/akcelik-strct.mjs.map +1 -1
- package/package.json +1 -1
- package/types/akcelik-strct.d.ts +91 -6
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@akcelik/strct",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.22.0",
|
|
4
4
|
"description": "UIStruct — a standalone Angular component library with a tokenised, multi-palette theme system, built for datacenter / infrastructure management UIs.",
|
|
5
5
|
"author": "Serkan Akcelik <serkan.akcelik@gmail.com>",
|
|
6
6
|
"license": "MIT",
|
package/types/akcelik-strct.d.ts
CHANGED
|
@@ -2312,49 +2312,134 @@ declare class StrctInputMask implements ControlValueAccessor {
|
|
|
2312
2312
|
interface StrctOption {
|
|
2313
2313
|
value: unknown;
|
|
2314
2314
|
label: string;
|
|
2315
|
-
/** Grayed out and skipped by keyboard navigation
|
|
2315
|
+
/** Grayed out and skipped by keyboard navigation. */
|
|
2316
2316
|
disabled?: boolean;
|
|
2317
|
+
/** Options sharing a group label render under one header (combobox). */
|
|
2318
|
+
group?: string;
|
|
2319
|
+
/** Leading icon in the option row (and on the chip in multiple mode). */
|
|
2320
|
+
icon?: StrctIconName;
|
|
2321
|
+
/** Secondary line under the label in the option row (combobox). */
|
|
2322
|
+
description?: string;
|
|
2323
|
+
}
|
|
2324
|
+
/** A render row of the option list: a group header or an option. */
|
|
2325
|
+
interface CbxRow {
|
|
2326
|
+
key: string;
|
|
2327
|
+
header?: string;
|
|
2328
|
+
opt?: StrctOption;
|
|
2329
|
+
/** Flat option index (headers carry none) — drives ids and highlight. */
|
|
2330
|
+
index?: number;
|
|
2317
2331
|
}
|
|
2318
2332
|
/**
|
|
2319
|
-
* Filterable
|
|
2320
|
-
*
|
|
2333
|
+
* Filterable select (autocomplete). CVA-compatible, fully keyboard driven
|
|
2334
|
+
* (↑/↓ move, Home/End jump, Enter picks, Esc closes) with the shared select
|
|
2335
|
+
* ergonomics: an aligned ✓ lead slot marks the current choice, the typed
|
|
2336
|
+
* match is emphasised in each label, and disabled options gray out and are
|
|
2337
|
+
* skipped.
|
|
2338
|
+
*
|
|
2321
2339
|
* <strct-combobox [options]="opts" [(ngModel)]="selected" placeholder="Pick…" />
|
|
2340
|
+
*
|
|
2341
|
+
* Variants: `clearable` adds an × that resets the selection; `multiple`
|
|
2342
|
+
* switches the value to an array and renders the picks as removable chips —
|
|
2343
|
+
* the list stays open while picking and Backspace on an empty query removes
|
|
2344
|
+
* the last chip. Options may carry `group` labels (rendered as headers),
|
|
2345
|
+
* `disabled`, a leading `icon` and a secondary `description` line.
|
|
2346
|
+
* `allowCustomValue` appends a "Use \"…\"" row while typing so the typed
|
|
2347
|
+
* text itself can be committed as a free-form value.
|
|
2322
2348
|
*/
|
|
2323
2349
|
declare class StrctCombobox implements ControlValueAccessor {
|
|
2324
2350
|
private readonly host;
|
|
2351
|
+
private readonly inputEl;
|
|
2325
2352
|
protected readonly listId: string;
|
|
2326
|
-
/** Available options. */
|
|
2353
|
+
/** Available options (`disabled` grays out; `group` renders headers). */
|
|
2327
2354
|
readonly options: _angular_core.InputSignal<StrctOption[]>;
|
|
2328
2355
|
/** Placeholder text when empty. */
|
|
2329
2356
|
readonly placeholder: _angular_core.InputSignal<string>;
|
|
2330
2357
|
/** Show a skeleton placeholder while options are loading. */
|
|
2331
2358
|
readonly loading: _angular_core.InputSignalWithTransform<boolean, unknown>;
|
|
2359
|
+
/** Show an × that resets the selection. */
|
|
2360
|
+
readonly clearable: _angular_core.InputSignalWithTransform<boolean, unknown>;
|
|
2361
|
+
/**
|
|
2362
|
+
* Multi-select: the value becomes an array and the picks render as
|
|
2363
|
+
* removable chips; the list stays open while picking.
|
|
2364
|
+
*/
|
|
2365
|
+
readonly multiple: _angular_core.InputSignalWithTransform<boolean, unknown>;
|
|
2366
|
+
/** Text shown when the filter matches nothing (localizable). */
|
|
2367
|
+
readonly emptyText: _angular_core.InputSignal<string>;
|
|
2368
|
+
/** Accessible label of the × clear button (localizable). */
|
|
2369
|
+
readonly clearLabel: _angular_core.InputSignal<string>;
|
|
2370
|
+
/** Accessible label prefix of a chip's × button (localizable). */
|
|
2371
|
+
readonly removeLabel: _angular_core.InputSignal<string>;
|
|
2372
|
+
/**
|
|
2373
|
+
* Allow committing the typed text itself: while the query has no exact
|
|
2374
|
+
* label match, a "Use \"…\"" row pinned to the list end (Enter or click)
|
|
2375
|
+
* commits the raw text as the value — appended to the array in `multiple`.
|
|
2376
|
+
*/
|
|
2377
|
+
readonly allowCustomValue: _angular_core.InputSignalWithTransform<boolean, unknown>;
|
|
2378
|
+
/** Verb prefix of the free-form row (localizable) — renders `Use "query"`. */
|
|
2379
|
+
readonly customText: _angular_core.InputSignal<string>;
|
|
2332
2380
|
readonly query: _angular_core.WritableSignal<string>;
|
|
2333
2381
|
readonly value: _angular_core.WritableSignal<unknown>;
|
|
2382
|
+
/** Selection in `multiple` mode. */
|
|
2383
|
+
readonly values: _angular_core.WritableSignal<unknown[]>;
|
|
2334
2384
|
readonly open: _angular_core.WritableSignal<boolean>;
|
|
2335
2385
|
readonly activeIndex: _angular_core.WritableSignal<number>;
|
|
2336
2386
|
readonly isDisabled: _angular_core.WritableSignal<boolean>;
|
|
2337
2387
|
/** True while the user is typing a filter that hasn't been committed yet. */
|
|
2338
2388
|
private readonly dirty;
|
|
2339
2389
|
protected readonly filtered: _angular_core.Signal<StrctOption[]>;
|
|
2390
|
+
/** Flat option list (no headers) — keyboard navigation and ids live here. */
|
|
2391
|
+
protected readonly flat: _angular_core.Signal<StrctOption[]>;
|
|
2392
|
+
/**
|
|
2393
|
+
* The free-form query committable right now (allowCustomValue): a trimmed
|
|
2394
|
+
* dirty query with no exact label match — and, in multiple mode, not
|
|
2395
|
+
* already picked. Rendered as an extra row at index `flat().length`.
|
|
2396
|
+
*/
|
|
2397
|
+
protected readonly customRow: _angular_core.Signal<string | null>;
|
|
2398
|
+
/** Navigable row count: options plus the custom row when shown. */
|
|
2399
|
+
protected readonly navCount: _angular_core.Signal<number>;
|
|
2400
|
+
/** Render rows: group headers interleaved with their options. */
|
|
2401
|
+
protected readonly rows: _angular_core.Signal<CbxRow[]>;
|
|
2402
|
+
protected readonly hasSelection: _angular_core.Signal<boolean>;
|
|
2340
2403
|
private onChange;
|
|
2341
2404
|
protected onTouched: () => void;
|
|
2405
|
+
protected isSelected(v: unknown): boolean;
|
|
2406
|
+
protected optionOf(v: unknown): StrctOption | undefined;
|
|
2407
|
+
protected labelOf(v: unknown): string;
|
|
2408
|
+
/** The typed match emphasised inside a label (first occurrence). */
|
|
2409
|
+
protected segments(label: string): {
|
|
2410
|
+
pre: string;
|
|
2411
|
+
match: string;
|
|
2412
|
+
post: string;
|
|
2413
|
+
};
|
|
2414
|
+
protected focusInput(): void;
|
|
2342
2415
|
openList(): void;
|
|
2343
2416
|
onType(event: Event): void;
|
|
2344
2417
|
onKeydown(event: KeyboardEvent): void;
|
|
2345
2418
|
private move;
|
|
2419
|
+
private firstEnabled;
|
|
2420
|
+
private lastEnabled;
|
|
2421
|
+
private scrollActiveIntoView;
|
|
2346
2422
|
select(opt: StrctOption, event: Event): void;
|
|
2347
2423
|
private commit;
|
|
2424
|
+
/**
|
|
2425
|
+
* Commit the typed text itself as a free-form value (allowCustomValue).
|
|
2426
|
+
* Multiple mode appends it and keeps picking; single mode takes it and
|
|
2427
|
+
* closes.
|
|
2428
|
+
*/
|
|
2429
|
+
protected commitCustom(event?: Event): void;
|
|
2430
|
+
protected removeValue(v: unknown, event?: Event): void;
|
|
2431
|
+
protected clear(event: Event): void;
|
|
2348
2432
|
protected onDocClick(event: MouseEvent): void;
|
|
2349
2433
|
private close;
|
|
2350
|
-
|
|
2434
|
+
/** Highlight starts on the selected option — or the first enabled one. */
|
|
2435
|
+
private initialIndex;
|
|
2351
2436
|
private syncQueryToValue;
|
|
2352
2437
|
writeValue(value: unknown): void;
|
|
2353
2438
|
registerOnChange(fn: (value: unknown) => void): void;
|
|
2354
2439
|
registerOnTouched(fn: () => void): void;
|
|
2355
2440
|
setDisabledState(isDisabled: boolean): void;
|
|
2356
2441
|
static ɵfac: _angular_core.ɵɵFactoryDeclaration<StrctCombobox, never>;
|
|
2357
|
-
static ɵcmp: _angular_core.ɵɵComponentDeclaration<StrctCombobox, "strct-combobox", never, { "options": { "alias": "options"; "required": false; "isSignal": true; }; "placeholder": { "alias": "placeholder"; "required": false; "isSignal": true; }; "loading": { "alias": "loading"; "required": false; "isSignal": true; }; }, {}, never, never, true, never>;
|
|
2442
|
+
static ɵcmp: _angular_core.ɵɵComponentDeclaration<StrctCombobox, "strct-combobox", never, { "options": { "alias": "options"; "required": false; "isSignal": true; }; "placeholder": { "alias": "placeholder"; "required": false; "isSignal": true; }; "loading": { "alias": "loading"; "required": false; "isSignal": true; }; "clearable": { "alias": "clearable"; "required": false; "isSignal": true; }; "multiple": { "alias": "multiple"; "required": false; "isSignal": true; }; "emptyText": { "alias": "emptyText"; "required": false; "isSignal": true; }; "clearLabel": { "alias": "clearLabel"; "required": false; "isSignal": true; }; "removeLabel": { "alias": "removeLabel"; "required": false; "isSignal": true; }; "allowCustomValue": { "alias": "allowCustomValue"; "required": false; "isSignal": true; }; "customText": { "alias": "customText"; "required": false; "isSignal": true; }; }, {}, never, never, true, never>;
|
|
2358
2443
|
}
|
|
2359
2444
|
|
|
2360
2445
|
/**
|