@akcelik/strct 1.18.0 → 1.20.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@akcelik/strct",
3
- "version": "1.18.0",
3
+ "version": "1.20.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",
@@ -1231,10 +1231,23 @@ declare class StrctDropdown {
1231
1231
  readonly popoverLabel: _angular_core.InputSignal<string>;
1232
1232
  readonly open: _angular_core.WritableSignal<boolean>;
1233
1233
  constructor();
1234
+ /** Where focus was when the menu opened — restored on Escape/selection. */
1235
+ private lastFocused;
1234
1236
  toggle(): void;
1235
- close(): void;
1236
- /** Menu items close on activation; popover form controls never do. */
1237
- protected onInnerActivate(): void;
1237
+ /** Open (if closed) and move focus into the menu — ArrowDown on the trigger. */
1238
+ openMenu(): void;
1239
+ close(restoreFocus?: boolean): void;
1240
+ /**
1241
+ * Menu mode closes ONLY on a real item activation — a click that lands on
1242
+ * the menu's padding or a divider (a 2px miss) keeps it open instead of
1243
+ * throwing the whole interaction away. Popover form controls never close.
1244
+ */
1245
+ protected onInnerActivate(event: Event): void;
1246
+ /** APG menu keyboarding: arrows rove, Home/End jump, Enter/Space activate. */
1247
+ protected onMenuKeydown(event: KeyboardEvent): void;
1248
+ private enabledItems;
1249
+ /** Focus the selected item if there is one, else the first — after render. */
1250
+ private focusInitialItem;
1238
1251
  protected onDocClick(event: MouseEvent): void;
1239
1252
  protected onEscape(): void;
1240
1253
  static ɵfac: _angular_core.ɵɵFactoryDeclaration<StrctDropdown, never>;
@@ -1247,17 +1260,25 @@ declare class StrctDropdown {
1247
1260
  */
1248
1261
  declare class StrctDropdownTrigger {
1249
1262
  protected readonly dd: StrctDropdown | null;
1263
+ protected onArrowDown(event: Event): void;
1250
1264
  static ɵfac: _angular_core.ɵɵFactoryDeclaration<StrctDropdownTrigger, never>;
1251
1265
  static ɵdir: _angular_core.ɵɵDirectiveDeclaration<StrctDropdownTrigger, "[strctDropdownTrigger]", never, {}, {}, never, never, true, never>;
1252
1266
  }
1253
1267
  /** A selectable row inside a `<strct-dropdown>`. */
1254
1268
  declare class StrctDropdownItem {
1269
+ /**
1270
+ * Select-like usage: bind `selected` and the item becomes a
1271
+ * `menuitemradio` with `aria-checked`, a leading ✓ on the current choice
1272
+ * and an aligned lead slot — so reopening the menu shows what is chosen.
1273
+ * Leave unbound for plain action items.
1274
+ */
1275
+ readonly selected: _angular_core.InputSignal<boolean | null>;
1255
1276
  /** Danger. */
1256
1277
  readonly critical: _angular_core.InputSignalWithTransform<boolean, unknown>;
1257
1278
  /** Static disable flag. */
1258
1279
  readonly disabled: _angular_core.InputSignalWithTransform<boolean, unknown>;
1259
1280
  static ɵfac: _angular_core.ɵɵFactoryDeclaration<StrctDropdownItem, never>;
1260
- static ɵcmp: _angular_core.ɵɵComponentDeclaration<StrctDropdownItem, "strct-dropdown-item", never, { "critical": { "alias": "critical"; "required": false; "isSignal": true; }; "disabled": { "alias": "disabled"; "required": false; "isSignal": true; }; }, {}, never, ["*"], true, never>;
1281
+ static ɵcmp: _angular_core.ɵɵComponentDeclaration<StrctDropdownItem, "strct-dropdown-item", never, { "selected": { "alias": "selected"; "required": false; "isSignal": true; }; "critical": { "alias": "critical"; "required": false; "isSignal": true; }; "disabled": { "alias": "disabled"; "required": false; "isSignal": true; }; }, {}, never, ["*"], true, never>;
1261
1282
  }
1262
1283
  /** Thin separator between groups of menu items. */
1263
1284
  declare class StrctDropdownDivider {
@@ -2291,6 +2312,8 @@ declare class StrctInputMask implements ControlValueAccessor {
2291
2312
  interface StrctOption {
2292
2313
  value: unknown;
2293
2314
  label: string;
2315
+ /** Grayed out and skipped by keyboard navigation (select). */
2316
+ disabled?: boolean;
2294
2317
  }
2295
2318
  /**
2296
2319
  * Filterable single-select (autocomplete). CVA-compatible, fully keyboard
@@ -2334,6 +2357,74 @@ declare class StrctCombobox implements ControlValueAccessor {
2334
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>;
2335
2358
  }
2336
2359
 
2360
+ /**
2361
+ * Select-only combobox (APG pattern): a real button trigger wearing the shared
2362
+ * `.strct-control` look, opening a token-styled listbox — so the option list
2363
+ * matches the theme instead of the OS popup a native `<select>` shows.
2364
+ * CVA-compatible; options are non-filterable (reach for `strct-combobox` when
2365
+ * the list needs typing to narrow).
2366
+ *
2367
+ * <strct-field label="Region">
2368
+ * <strct-select [options]="regions" [(ngModel)]="region" placeholder="Pick a region" />
2369
+ * </strct-field>
2370
+ *
2371
+ * Keyboard follows the native select: ArrowDown/Up and Enter/Space open,
2372
+ * arrows move (skipping disabled options), Home/End jump, typing jumps to the
2373
+ * matching label (typeahead), Enter/Space commit, Escape/Tab close without
2374
+ * committing. The selected option carries a leading ✓ and gets the highlight
2375
+ * when reopening — the same select ergonomics as `strct-dropdown-item
2376
+ * [selected]`.
2377
+ */
2378
+ declare class StrctSelect implements ControlValueAccessor {
2379
+ private readonly host;
2380
+ protected readonly listId: string;
2381
+ /** Available options (set `disabled: true` on an option to gray it out). */
2382
+ readonly options: _angular_core.InputSignal<StrctOption[]>;
2383
+ /** Muted text shown while no value is selected (localizable). */
2384
+ readonly placeholder: _angular_core.InputSignal<string>;
2385
+ /** Accessible name of the listbox (localizable). */
2386
+ readonly listLabel: _angular_core.InputSignal<string>;
2387
+ /** Text shown when `options` is empty (localizable). */
2388
+ readonly emptyText: _angular_core.InputSignal<string>;
2389
+ /** Static disable flag (forms also drive it via setDisabledState). */
2390
+ readonly disabled: _angular_core.InputSignalWithTransform<boolean, unknown>;
2391
+ readonly value: _angular_core.WritableSignal<unknown>;
2392
+ readonly open: _angular_core.WritableSignal<boolean>;
2393
+ readonly activeIndex: _angular_core.WritableSignal<number>;
2394
+ readonly isDisabled: _angular_core.WritableSignal<boolean>;
2395
+ protected readonly selectedOption: _angular_core.Signal<StrctOption | undefined>;
2396
+ /** Typeahead buffer — clears half a second after the last keystroke. */
2397
+ private typed;
2398
+ private typedTimer;
2399
+ private onChange;
2400
+ private onTouched;
2401
+ toggle(): void;
2402
+ openList(): void;
2403
+ close(): void;
2404
+ protected onKeydown(event: KeyboardEvent): void;
2405
+ /**
2406
+ * Native-select typeahead: letters accumulate into a prefix that jumps to
2407
+ * the matching label; repeating one letter cycles its matches instead.
2408
+ */
2409
+ private typeahead;
2410
+ private move;
2411
+ /** Jump to `index`, walking `dir` past disabled options. */
2412
+ private moveTo;
2413
+ protected pick(opt: StrctOption, event: Event): void;
2414
+ private commit;
2415
+ protected onBlur(): void;
2416
+ /** Highlight starts on the selected option — or the first enabled one. */
2417
+ private initialIndex;
2418
+ private scrollActiveIntoView;
2419
+ protected onDocClick(event: MouseEvent): void;
2420
+ writeValue(value: unknown): void;
2421
+ registerOnChange(fn: (value: unknown) => void): void;
2422
+ registerOnTouched(fn: () => void): void;
2423
+ setDisabledState(isDisabled: boolean): void;
2424
+ static ɵfac: _angular_core.ɵɵFactoryDeclaration<StrctSelect, never>;
2425
+ 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>;
2426
+ }
2427
+
2337
2428
  interface DayCell {
2338
2429
  day: number;
2339
2430
  iso: string;
@@ -4424,5 +4515,5 @@ declare class StrctReorderItem {
4424
4515
  static ɵdir: _angular_core.ɵɵDirectiveDeclaration<StrctReorderItem, "[strctReorderItem]", never, {}, {}, never, never, true, never>;
4425
4516
  }
4426
4517
 
4427
- 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 };
4518
+ 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 };
4428
4519
  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 };