@akcelik/strct 1.19.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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@akcelik/strct",
3
- "version": "1.19.0",
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",
@@ -2312,47 +2312,202 @@ 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. */
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;
2315
2331
  }
2316
2332
  /**
2317
- * Filterable single-select (autocomplete). CVA-compatible, fully keyboard
2318
- * driven (↑/↓ to move, Enter to pick, Esc to close).
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
+ *
2319
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.
2320
2348
  */
2321
2349
  declare class StrctCombobox implements ControlValueAccessor {
2322
2350
  private readonly host;
2351
+ private readonly inputEl;
2323
2352
  protected readonly listId: string;
2324
- /** Available options. */
2353
+ /** Available options (`disabled` grays out; `group` renders headers). */
2325
2354
  readonly options: _angular_core.InputSignal<StrctOption[]>;
2326
2355
  /** Placeholder text when empty. */
2327
2356
  readonly placeholder: _angular_core.InputSignal<string>;
2328
2357
  /** Show a skeleton placeholder while options are loading. */
2329
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>;
2330
2380
  readonly query: _angular_core.WritableSignal<string>;
2331
2381
  readonly value: _angular_core.WritableSignal<unknown>;
2382
+ /** Selection in `multiple` mode. */
2383
+ readonly values: _angular_core.WritableSignal<unknown[]>;
2332
2384
  readonly open: _angular_core.WritableSignal<boolean>;
2333
2385
  readonly activeIndex: _angular_core.WritableSignal<number>;
2334
2386
  readonly isDisabled: _angular_core.WritableSignal<boolean>;
2335
2387
  /** True while the user is typing a filter that hasn't been committed yet. */
2336
2388
  private readonly dirty;
2337
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>;
2338
2403
  private onChange;
2339
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;
2340
2415
  openList(): void;
2341
2416
  onType(event: Event): void;
2342
2417
  onKeydown(event: KeyboardEvent): void;
2343
2418
  private move;
2419
+ private firstEnabled;
2420
+ private lastEnabled;
2421
+ private scrollActiveIntoView;
2344
2422
  select(opt: StrctOption, event: Event): void;
2345
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;
2346
2432
  protected onDocClick(event: MouseEvent): void;
2347
2433
  private close;
2348
- private indexOfValue;
2434
+ /** Highlight starts on the selected option — or the first enabled one. */
2435
+ private initialIndex;
2349
2436
  private syncQueryToValue;
2350
2437
  writeValue(value: unknown): void;
2351
2438
  registerOnChange(fn: (value: unknown) => void): void;
2352
2439
  registerOnTouched(fn: () => void): void;
2353
2440
  setDisabledState(isDisabled: boolean): void;
2354
2441
  static ɵfac: _angular_core.ɵɵFactoryDeclaration<StrctCombobox, never>;
2355
- 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>;
2443
+ }
2444
+
2445
+ /**
2446
+ * Select-only combobox (APG pattern): a real button trigger wearing the shared
2447
+ * `.strct-control` look, opening a token-styled listbox — so the option list
2448
+ * matches the theme instead of the OS popup a native `<select>` shows.
2449
+ * CVA-compatible; options are non-filterable (reach for `strct-combobox` when
2450
+ * the list needs typing to narrow).
2451
+ *
2452
+ * <strct-field label="Region">
2453
+ * <strct-select [options]="regions" [(ngModel)]="region" placeholder="Pick a region" />
2454
+ * </strct-field>
2455
+ *
2456
+ * Keyboard follows the native select: ArrowDown/Up and Enter/Space open,
2457
+ * arrows move (skipping disabled options), Home/End jump, typing jumps to the
2458
+ * matching label (typeahead), Enter/Space commit, Escape/Tab close without
2459
+ * committing. The selected option carries a leading ✓ and gets the highlight
2460
+ * when reopening — the same select ergonomics as `strct-dropdown-item
2461
+ * [selected]`.
2462
+ */
2463
+ declare class StrctSelect implements ControlValueAccessor {
2464
+ private readonly host;
2465
+ protected readonly listId: string;
2466
+ /** Available options (set `disabled: true` on an option to gray it out). */
2467
+ readonly options: _angular_core.InputSignal<StrctOption[]>;
2468
+ /** Muted text shown while no value is selected (localizable). */
2469
+ readonly placeholder: _angular_core.InputSignal<string>;
2470
+ /** Accessible name of the listbox (localizable). */
2471
+ readonly listLabel: _angular_core.InputSignal<string>;
2472
+ /** Text shown when `options` is empty (localizable). */
2473
+ readonly emptyText: _angular_core.InputSignal<string>;
2474
+ /** Static disable flag (forms also drive it via setDisabledState). */
2475
+ readonly disabled: _angular_core.InputSignalWithTransform<boolean, unknown>;
2476
+ readonly value: _angular_core.WritableSignal<unknown>;
2477
+ readonly open: _angular_core.WritableSignal<boolean>;
2478
+ readonly activeIndex: _angular_core.WritableSignal<number>;
2479
+ readonly isDisabled: _angular_core.WritableSignal<boolean>;
2480
+ protected readonly selectedOption: _angular_core.Signal<StrctOption | undefined>;
2481
+ /** Typeahead buffer — clears half a second after the last keystroke. */
2482
+ private typed;
2483
+ private typedTimer;
2484
+ private onChange;
2485
+ private onTouched;
2486
+ toggle(): void;
2487
+ openList(): void;
2488
+ close(): void;
2489
+ protected onKeydown(event: KeyboardEvent): void;
2490
+ /**
2491
+ * Native-select typeahead: letters accumulate into a prefix that jumps to
2492
+ * the matching label; repeating one letter cycles its matches instead.
2493
+ */
2494
+ private typeahead;
2495
+ private move;
2496
+ /** Jump to `index`, walking `dir` past disabled options. */
2497
+ private moveTo;
2498
+ protected pick(opt: StrctOption, event: Event): void;
2499
+ private commit;
2500
+ protected onBlur(): void;
2501
+ /** Highlight starts on the selected option — or the first enabled one. */
2502
+ private initialIndex;
2503
+ private scrollActiveIntoView;
2504
+ protected onDocClick(event: MouseEvent): void;
2505
+ writeValue(value: unknown): void;
2506
+ registerOnChange(fn: (value: unknown) => void): void;
2507
+ registerOnTouched(fn: () => void): void;
2508
+ setDisabledState(isDisabled: boolean): void;
2509
+ static ɵfac: _angular_core.ɵɵFactoryDeclaration<StrctSelect, never>;
2510
+ static ɵcmp: _angular_core.ɵɵComponentDeclaration<StrctSelect, "strct-select", never, { "options": { "alias": "options"; "required": false; "isSignal": true; }; "placeholder": { "alias": "placeholder"; "required": false; "isSignal": true; }; "listLabel": { "alias": "listLabel"; "required": false; "isSignal": true; }; "emptyText": { "alias": "emptyText"; "required": false; "isSignal": true; }; "disabled": { "alias": "disabled"; "required": false; "isSignal": true; }; }, {}, never, never, true, never>;
2356
2511
  }
2357
2512
 
2358
2513
  interface DayCell {
@@ -4445,5 +4600,5 @@ declare class StrctReorderItem {
4445
4600
  static ɵdir: _angular_core.ɵɵDirectiveDeclaration<StrctReorderItem, "[strctReorderItem]", never, {}, {}, never, never, true, never>;
4446
4601
  }
4447
4602
 
4448
- export { STRCT_ICONS, STRCT_ICON_GROUPS, STRCT_ICON_NAMES, STRCT_MASKS, STRCT_PALETTES, STRCT_RAW_ICONS, STRCT_TIME_RANGE_PRESETS, STRCT_WIZARD_DEFAULTS, StrctAccordion, StrctAccordionPanel, StrctAlert, StrctAnnouncer, StrctAvatar, StrctBadge, StrctBreadcrumb, StrctBreadcrumbItem, StrctButton, StrctButtonGroup, StrctBytesPipe, StrctCard, StrctCardBlock, StrctCardFooter, StrctCardHeader, StrctCascadeHost, StrctCascadeNode, StrctCascadeSelect, StrctCellDef, StrctCellStatus, StrctChart, StrctCheckbox, StrctChips, StrctCode, StrctColorPicker, StrctCombobox, StrctCommandPalette, StrctContextMenu, StrctContextMenuTrigger, StrctCopy, StrctDatagrid, StrctDatagridActionBar, StrctDatepicker, StrctDesc, StrctDescriptionList, StrctDiff, StrctDivider, StrctDonut, StrctDrawer, StrctDrawerFooter, StrctDropdown, StrctDropdownDivider, StrctDropdownItem, StrctDropdownTrigger, StrctDurationPipe, StrctEmptyState, StrctField, StrctFile, StrctFilterBar, StrctFlow, StrctFooter, StrctGauge, StrctHeader, StrctHero, StrctHotkeysHelp, StrctHotkeysService, StrctIcon, StrctInput, StrctInputMask, StrctInputOtp, StrctKbd, StrctKnob, StrctLogViewer, StrctLogin, StrctMenuPanel, StrctMenuService, StrctMenubar, StrctMetricTile, StrctModal, StrctNav, StrctNavItem, StrctOverlay, StrctPageHeader, StrctPageHeaderActions, StrctPageHeaderCrumbs, StrctPagination, StrctPassword, StrctProgress, StrctRadio, StrctRadioGroup, StrctRail, StrctRange, StrctRatePipe, StrctRating, StrctReorder, StrctReorderItem, StrctRowDetailDef, StrctSearchbox, StrctSectionMenu, StrctSegmented, StrctShell, StrctShellService, StrctSiPipe, StrctSignpost, StrctSkeleton, StrctSparkline, StrctSpeedDial, StrctSpinner, StrctSplitButton, StrctSplitter, StrctStack, StrctStackItem, StrctStep, StrctSubmenu, StrctTab, StrctTable, StrctTabs, StrctTag, StrctThemeService, StrctThemeSwitcher, StrctTimeRangePicker, StrctTimeline, StrctTimelineItem, StrctToastOutlet, StrctToastService, StrctToggle, StrctTooltip, StrctTour, StrctTransfer, StrctTree, StrctTreeNode, StrctVerticalNav, StrctWatermark, StrctWizard, StrctWizardAside, parseAnsi, provideStrctWizardDefaults, registerStrctIcon, strctComputeDiff, strctFormatBytes, strctFormatDuration, strctFormatRate, strctFormatSi, strctValidationIcon, strctValidationTone };
4603
+ export { STRCT_ICONS, STRCT_ICON_GROUPS, STRCT_ICON_NAMES, STRCT_MASKS, STRCT_PALETTES, STRCT_RAW_ICONS, STRCT_TIME_RANGE_PRESETS, STRCT_WIZARD_DEFAULTS, StrctAccordion, StrctAccordionPanel, StrctAlert, StrctAnnouncer, StrctAvatar, StrctBadge, StrctBreadcrumb, StrctBreadcrumbItem, StrctButton, StrctButtonGroup, StrctBytesPipe, StrctCard, StrctCardBlock, StrctCardFooter, StrctCardHeader, StrctCascadeHost, StrctCascadeNode, StrctCascadeSelect, StrctCellDef, StrctCellStatus, StrctChart, StrctCheckbox, StrctChips, StrctCode, StrctColorPicker, StrctCombobox, StrctCommandPalette, StrctContextMenu, StrctContextMenuTrigger, StrctCopy, StrctDatagrid, StrctDatagridActionBar, StrctDatepicker, StrctDesc, StrctDescriptionList, StrctDiff, StrctDivider, StrctDonut, StrctDrawer, StrctDrawerFooter, StrctDropdown, StrctDropdownDivider, StrctDropdownItem, StrctDropdownTrigger, StrctDurationPipe, StrctEmptyState, StrctField, StrctFile, StrctFilterBar, StrctFlow, StrctFooter, StrctGauge, StrctHeader, StrctHero, StrctHotkeysHelp, StrctHotkeysService, StrctIcon, StrctInput, StrctInputMask, StrctInputOtp, StrctKbd, StrctKnob, StrctLogViewer, StrctLogin, StrctMenuPanel, StrctMenuService, StrctMenubar, StrctMetricTile, StrctModal, StrctNav, StrctNavItem, StrctOverlay, StrctPageHeader, StrctPageHeaderActions, StrctPageHeaderCrumbs, StrctPagination, StrctPassword, StrctProgress, StrctRadio, StrctRadioGroup, StrctRail, StrctRange, StrctRatePipe, StrctRating, StrctReorder, StrctReorderItem, StrctRowDetailDef, StrctSearchbox, StrctSectionMenu, StrctSegmented, StrctSelect, StrctShell, StrctShellService, StrctSiPipe, StrctSignpost, StrctSkeleton, StrctSparkline, StrctSpeedDial, StrctSpinner, StrctSplitButton, StrctSplitter, StrctStack, StrctStackItem, StrctStep, StrctSubmenu, StrctTab, StrctTable, StrctTabs, StrctTag, StrctThemeService, StrctThemeSwitcher, StrctTimeRangePicker, StrctTimeline, StrctTimelineItem, StrctToastOutlet, StrctToastService, StrctToggle, StrctTooltip, StrctTour, StrctTransfer, StrctTree, StrctTreeNode, StrctVerticalNav, StrctWatermark, StrctWizard, StrctWizardAside, parseAnsi, provideStrctWizardDefaults, registerStrctIcon, strctComputeDiff, strctFormatBytes, strctFormatDuration, strctFormatRate, strctFormatSi, strctValidationIcon, strctValidationTone };
4449
4604
  export type { StrctAlertType, StrctAvatarSize, StrctAvatarStatus, StrctBadgeStatus, StrctButtonSize, StrctButtonVariant, StrctCascadeOption, StrctCellContext, StrctChartAnnotation, StrctChartColor, StrctChartCurve, StrctChartSeries, StrctChartSlot, StrctChartStatus, StrctChartThreshold, StrctChartType, StrctColumn, StrctCommandItem, StrctDatagridColumn, StrctDatagridColumnState, StrctDatagridFilters, StrctDatagridLabels, StrctDatagridLazyState, StrctDescAlign, StrctDescItem, StrctDiffRow, StrctDonutSegment, StrctDrawerSide, StrctDrawerSize, StrctEmptyVariant, StrctFilterChip, StrctFlowDirection, StrctFlowNode, StrctFlowOrientation, StrctHotkey, StrctIconBadge, StrctIconName, StrctKnobStatus, StrctLogLine, StrctMenuItem, StrctMenuLink, StrctMenuOpenOptions, StrctMenuSection, StrctMenubarItem, StrctMetricStatus, StrctModalSize, StrctMode, StrctOption, StrctOverlayPlacement, StrctPalette, StrctPaletteInfo, StrctProgressStatus, StrctRailItem, StrctRailStatus, StrctReorderEvent, StrctRow, StrctRowId, StrctSegmentedOption, StrctSegmentedSize, StrctSignpostPosition, StrctSpeedDialDirection, StrctSpinnerSize, StrctStatus, StrctTagStatus, StrctThresholds, StrctTimeRange, StrctTimeRangePreset, StrctTimelineState, StrctToast, StrctToastOptions, StrctToastType, StrctTooltipPosition, StrctTourStep, StrctTransferItem, StrctTreeMenuEvent, StrctTreeNodeData, StrctTreeNodeMenuFn, StrctValidationState, StrctValidationStatus, StrctWizardDefaults };