@gravionlabs/helix-ui 22.8.0 → 22.9.1

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.
@@ -1,12 +1,13 @@
1
1
  import * as i1 from "@angular/cdk/accordion";
2
2
  import { CdkAccordionItem } from "@angular/cdk/accordion";
3
3
  import * as i0 from "@angular/core";
4
- import { ElementRef, EnvironmentProviders, InjectionToken, OnInit, Signal, TemplateRef, Type } from "@angular/core";
4
+ import { AfterContentChecked, ElementRef, EnvironmentProviders, InjectionToken, OnInit, Signal, TemplateRef, Type } from "@angular/core";
5
5
  import { ConnectedOverlayPositionChange, ConnectedPosition } from "@angular/cdk/overlay";
6
6
  import { ControlValueAccessor } from "@angular/forms";
7
7
  import { FormValueControl } from "@angular/forms/signals";
8
8
  import { Observable, Subject } from "rxjs";
9
9
  import { DialogRef } from "@angular/cdk/dialog";
10
+ import { FocusableOption } from "@angular/cdk/a11y";
10
11
  import { ListboxValueChangeEvent } from "@angular/cdk/listbox";
11
12
  type HxAccordionValue = string | string[] | null;
12
13
  /**
@@ -3688,6 +3689,89 @@ export declare class HxDrawer {
3688
3689
  "hidden": "hidden";
3689
3690
  }, never, ["[hxDialogHeader]", "*", "[hxDialogFooter]"], true, never>;
3690
3691
  }
3692
+ /**
3693
+ * What an `hx-field` hands to a composite control inside it: the control binds these to its own focusable
3694
+ * element. Native controls get the same as DOM attributes from the field and do not need it.
3695
+ */
3696
+ interface HxFieldContext {
3697
+ /** The host element of the control the field wires; another control inside the field ignores the context. */
3698
+ readonly control: Signal<Element | null>;
3699
+ /** The id for the focusable element, unless the control was given one. */
3700
+ readonly controlId: string;
3701
+ /** The ids of the hint and error texts that are shown. */
3702
+ readonly describedBy: Signal<string | null>;
3703
+ /** Whether the control shows as invalid; `null` when the field knows nothing about it. */
3704
+ readonly invalid: Signal<boolean | null>;
3705
+ readonly isRequired: Signal<boolean>;
3706
+ }
3707
+ /**
3708
+ * A form field around one control (`hx-input`, `hx-checkbox`, `hx-radio`, `hx-switch` or `hx-select`): the label,
3709
+ * the hint, the error and the required marker, with `id`/`for`, `aria-describedby`, `aria-invalid` and
3710
+ * `aria-required` wired for it. The control stays what it is, in template-driven, reactive and signal forms.
3711
+ *
3712
+ * ```html
3713
+ * <hx-field label="Email" hint="We never share it">
3714
+ * <input hx-input type="email" [formField]="signup.email" />
3715
+ * </hx-field>
3716
+ * <hx-field label="Name" error="Enter your name">
3717
+ * <input hx-input formControlName="name" />
3718
+ * </hx-field>
3719
+ * ```
3720
+ *
3721
+ * With a form bound to the control, the control is invalid and the error shows once it is invalid and touched.
3722
+ * The error is `error`, else (signal forms) the `message` of the field's first error. Without a form, a set
3723
+ * `error` shows at once.
3724
+ */
3725
+ export declare class HxField implements HxFieldContext, AfterContentChecked {
3726
+ #private;
3727
+ /** The visible label of the control. */
3728
+ readonly label: import("@angular/core").InputSignal<string | undefined>;
3729
+ /** Help text below the control. */
3730
+ readonly hint: import("@angular/core").InputSignal<string | undefined>;
3731
+ /** The error text; it replaces the message of the form's error. */
3732
+ readonly error: import("@angular/core").InputSignal<string | null | undefined>;
3733
+ /** Marks the control as required; a `required` validator or attribute of the control does so as well. */
3734
+ readonly required: import("@angular/core").InputSignalWithTransform<boolean, unknown>;
3735
+ readonly controlId: string;
3736
+ protected readonly hintId: string;
3737
+ protected readonly errorId: string;
3738
+ private readonly formField;
3739
+ private readonly ngControl;
3740
+ private readonly box;
3741
+ /** The host element of the control. */
3742
+ readonly control: import("@angular/core").WritableSignal<Element | null>;
3743
+ /** The id the label points at. */
3744
+ protected readonly labelFor: import("@angular/core").WritableSignal<string | null>;
3745
+ readonly invalid: import("@angular/core").Signal<boolean | null>;
3746
+ readonly isRequired: import("@angular/core").Signal<boolean>;
3747
+ protected readonly message: import("@angular/core").Signal<string | null>;
3748
+ readonly describedBy: import("@angular/core").Signal<string | null>;
3749
+ constructor();
3750
+ ngAfterContentChecked(): void;
3751
+ static ɵfac: i0.ɵɵFactoryDeclaration<HxField, never>;
3752
+ static ɵcmp: i0.ɵɵComponentDeclaration<HxField, "hx-field", ["hx-field"], {
3753
+ "label": {
3754
+ "alias": "label";
3755
+ "required": false;
3756
+ "isSignal": true;
3757
+ };
3758
+ "hint": {
3759
+ "alias": "hint";
3760
+ "required": false;
3761
+ "isSignal": true;
3762
+ };
3763
+ "error": {
3764
+ "alias": "error";
3765
+ "required": false;
3766
+ "isSignal": true;
3767
+ };
3768
+ "required": {
3769
+ "alias": "required";
3770
+ "required": false;
3771
+ "isSignal": true;
3772
+ };
3773
+ }, {}, ["formField", "ngControl"], ["*"], true, never>;
3774
+ }
3691
3775
  /**
3692
3776
  * A native `<fieldset>` with a `<legend>` that groups related controls and can collapse.
3693
3777
  *
@@ -4652,6 +4736,90 @@ export declare class HxKbd {
4652
4736
  };
4653
4737
  }, {}, never, never, true, never>;
4654
4738
  }
4739
+ /** What the list is: a plain list of buttons and links, or a listbox of options. */
4740
+ type HxListRole = 'list' | 'listbox';
4741
+ /** The `aria-current` value of the current row; `true` writes `aria-current="true"`. */
4742
+ type HxListRowCurrent = boolean | 'page' | 'step' | 'location' | 'date' | 'time';
4743
+ /**
4744
+ * A list of rows for sidebars, search results, outlines and pickers: the container of `[hx-list-row]`. It owns
4745
+ * the keyboard: the list is one tab stop, Arrow Up and Down move between the rows (without wrapping), Home and
4746
+ * End jump to the first and last one. Disabled and `hidden` rows are skipped.
4747
+ *
4748
+ * ```html
4749
+ * <hx-list aria-label="Branches">
4750
+ * <button hx-list-row type="button" [selected]="branch() === 'main'">main</button>
4751
+ * <a hx-list-row routerLink="/settings" [current]="settingsOpen()">Settings</a>
4752
+ * </hx-list>
4753
+ * ```
4754
+ *
4755
+ * With `role="list"` (default) the rows keep their native roles inside a `group`, and `selected` is
4756
+ * `aria-pressed`. With `role="listbox"` the rows are `option`s and `selected` is `aria-selected`. Give the list
4757
+ * an accessible name.
4758
+ */
4759
+ export declare class HxList {
4760
+ /** `list` (default) or `listbox`. */
4761
+ readonly role: import("@angular/core").InputSignal<HxListRole>;
4762
+ private readonly allRows;
4763
+ /** The rows of this list, in document order, without the rows of a nested list. */
4764
+ private readonly rows;
4765
+ private readonly keys;
4766
+ /** The row that had the focus last; it stays the tab stop. */
4767
+ private focused;
4768
+ constructor();
4769
+ /** Called by a row that received the focus. */
4770
+ rowFocused(row: HxListRow): void;
4771
+ protected onKeydown(event: KeyboardEvent): void;
4772
+ /**
4773
+ * One row is reachable with Tab: the one focused last, else the current one, else the selected one, else the
4774
+ * first.
4775
+ */
4776
+ private updateTabStop;
4777
+ static ɵfac: i0.ɵɵFactoryDeclaration<HxList, never>;
4778
+ static ɵdir: i0.ɵɵDirectiveDeclaration<HxList, "hx-list", ["hx-list"], {
4779
+ "role": {
4780
+ "alias": "role";
4781
+ "required": false;
4782
+ "isSignal": true;
4783
+ };
4784
+ }, {}, ["allRows"], never, true, never>;
4785
+ }
4786
+ /**
4787
+ * A row of an `hx-list`, on a native `button` or `a`, so activation and link behaviour stay native. Put
4788
+ * `.hx-list-row-icon`, `.hx-list-row-label` (truncates) and `.hx-list-row-meta` (trailing text or badge) inside.
4789
+ *
4790
+ * `selected` sets `aria-selected` in a listbox and `aria-pressed` on a button in a list; a selected link in a
4791
+ * list gets `aria-current="true"`, because a link cannot be pressed. Left unbound, a button is a plain button.
4792
+ * `current` sets `aria-current`.
4793
+ */
4794
+ export declare class HxListRow implements FocusableOption {
4795
+ /** The row is selected. */
4796
+ readonly selected: import("@angular/core").InputSignalWithTransform<boolean | undefined, unknown>;
4797
+ /** The row is the current item, e.g. the open page: `true`, `'page'`, `'step'`, `'location'`, … */
4798
+ readonly current: import("@angular/core").InputSignalWithTransform<HxListRowCurrent, "" | "true" | HxListRowCurrent | null | undefined>;
4799
+ /** The list the row belongs to. */
4800
+ readonly list: HxList | null;
4801
+ readonly element: HTMLElement;
4802
+ protected readonly staticRole: string | null;
4803
+ /** Disabled (`disabled` or `aria-disabled="true"`) and hidden rows are skipped by the keyboard. */
4804
+ get disabled(): boolean;
4805
+ focus(): void;
4806
+ protected get listbox(): boolean;
4807
+ protected get ariaPressed(): boolean | null;
4808
+ protected get ariaCurrent(): string | null;
4809
+ static ɵfac: i0.ɵɵFactoryDeclaration<HxListRow, never>;
4810
+ static ɵdir: i0.ɵɵDirectiveDeclaration<HxListRow, "button[hx-list-row], a[hx-list-row]", ["hx-list-row"], {
4811
+ "selected": {
4812
+ "alias": "selected";
4813
+ "required": false;
4814
+ "isSignal": true;
4815
+ };
4816
+ "current": {
4817
+ "alias": "current";
4818
+ "required": false;
4819
+ "isSignal": true;
4820
+ };
4821
+ }, {}, never, never, true, never>;
4822
+ }
4655
4823
  /**
4656
4824
  * An inline list of options, single or `multiple`, on the CDK listbox (`aria-multiselectable`, active
4657
4825
  * descendant, typeahead, arrows, Home, End). With `filter` a text field above the list narrows the options by
@@ -5578,7 +5746,7 @@ type HxSelectItem<V = unknown> = HxOption<V>;
5578
5746
  *
5579
5747
  * `options` may hold primitives (label = the value as text) or objects (`optionLabel`, `optionValue` and
5580
5748
  * `optionDisabled` name a key or give a function; defaults `label`, `value` and `disabled`).
5581
- * Give the select a visible `<label for>` (with `inputId`) or an `ariaLabel`.
5749
+ * Give the select a visible `<label for>` (with `inputId`) or an `ariaLabel`, or put it in an `hx-field`.
5582
5750
  */
5583
5751
  export declare class HxSelect<V = unknown> implements ControlValueAccessor, FormValueControl<V | null> {
5584
5752
  #private;
@@ -5614,6 +5782,9 @@ export declare class HxSelect<V = unknown> implements ControlValueAccessor, Form
5614
5782
  readonly disabled: import("@angular/core").InputSignalWithTransform<boolean, unknown>;
5615
5783
  readonly invalid: import("@angular/core").InputSignalWithTransform<boolean, unknown>;
5616
5784
  readonly touch: import("@angular/core").OutputEmitterRef<void>;
5785
+ protected readonly field: import("@angular/core").Signal<HxFieldContext | null>;
5786
+ protected readonly showsInvalid: import("@angular/core").Signal<boolean>;
5787
+ protected readonly describedBy: import("@angular/core").Signal<string | null>;
5617
5788
  readonly open: import("@angular/core").WritableSignal<boolean>;
5618
5789
  protected readonly panelWidth: import("@angular/core").WritableSignal<number>;
5619
5790
  protected readonly panelId: string;
@@ -7435,4 +7606,4 @@ export declare class HxTree {
7435
7606
  "nodeCollapse": "nodeCollapse";
7436
7607
  }, ["template"], never, true, never>;
7437
7608
  }
7438
- export type { HxAccordionValue, HxAutoCompleteEvent, HxAutoCompleteSize, HxAvatarShape, HxAvatarSize, HxBadgeSeverity, HxBadgeSize, HxBreadcrumbItem, HxBundledPreset, HxButtonSeverity, HxButtonSize, HxButtonVariant, HxCarouselItemContext, HxCarouselOrientation, HxCarouselResponsiveOption, HxCellContext, HxCheckboxSize, HxColumn, HxColumnAlign, HxColumnHeaderContext, HxConfirmation, HxDateMathOptions, HxDateMathUnit, HxDatePickerSelectionMode, HxDatePickerValue, HxDateRangeExpression, HxDateRangePresetId, HxDateRangeQuickSelectValue, HxDateTimePickerValue, HxDateTimeRangePreset, HxDateTimeRangePresetContext, HxDateTimeRangeValue, HxDensity, HxDialogConfig, HxDialogPosition, HxDividerAlign, HxDividerLayout, HxDividerType, HxDrawerPosition, HxFileUploadMode, HxFloatLabelVariant, HxGalleriaItem, HxGalleriaItemContext, HxGalleriaThumbnailsPosition, HxIconPosition, HxInputNumberButtonLayout, HxInputNumberMode, HxInputNumberSize, HxInputNumberVariant, HxInputSize, HxInputVariant, HxKbdSeparator, HxKbdSize, HxLazyLoadEvent, HxMenuItem, HxMenuItemCommandEvent, HxMenuPoint, HxMessageSeverity, HxMessageSize, HxMessageVariant, HxMultiSelectDisplay, HxMultiSelectSize, HxMultiSelectVariant, HxPageEvent, HxPrimaryColor, HxPrimaryScale, HxProgressMode, HxQuickSelectLabels, HxQuickSelectRange, HxRadioSize, HxRowClass, HxSelectButtonSize, HxSelectItem, HxSelectSize, HxSelectVariant, HxSelectionMode, HxSkeletonAnimation, HxSkeletonShape, HxSliderOrientation, HxSliderValue, HxSortFirstOrder, HxSortFunction, HxSortMeta, HxSortMode, HxStepContentContext, HxStepValue, HxSurface, HxTabBarItem, HxTabBarMenuItem, HxTabBarMove, HxTabBarReceive, HxTableColumnsContext, HxTableRowContext, HxTableSize, HxTagSeverity, HxThemeOptions, HxThemePreset, HxTimePickerValue, HxTimelineAlign, HxTimelineContext, HxTimelineLayout, HxToastMessage, HxToastMessageInput, HxToastPosition, HxToastSeverity, HxToggleButtonSize, HxTooltipEvent, HxTooltipPosition, HxTreeFilterMode, HxTreeNode, HxTreeNodeContext, HxTreeNodeEvent, HxTreeSelection, HxTreeSelectionMode };
7609
+ export type { HxAccordionValue, HxAutoCompleteEvent, HxAutoCompleteSize, HxAvatarShape, HxAvatarSize, HxBadgeSeverity, HxBadgeSize, HxBreadcrumbItem, HxBundledPreset, HxButtonSeverity, HxButtonSize, HxButtonVariant, HxCarouselItemContext, HxCarouselOrientation, HxCarouselResponsiveOption, HxCellContext, HxCheckboxSize, HxColumn, HxColumnAlign, HxColumnHeaderContext, HxConfirmation, HxDateMathOptions, HxDateMathUnit, HxDatePickerSelectionMode, HxDatePickerValue, HxDateRangeExpression, HxDateRangePresetId, HxDateRangeQuickSelectValue, HxDateTimePickerValue, HxDateTimeRangePreset, HxDateTimeRangePresetContext, HxDateTimeRangeValue, HxDensity, HxDialogConfig, HxDialogPosition, HxDividerAlign, HxDividerLayout, HxDividerType, HxDrawerPosition, HxFileUploadMode, HxFloatLabelVariant, HxGalleriaItem, HxGalleriaItemContext, HxGalleriaThumbnailsPosition, HxIconPosition, HxInputNumberButtonLayout, HxInputNumberMode, HxInputNumberSize, HxInputNumberVariant, HxInputSize, HxInputVariant, HxKbdSeparator, HxKbdSize, HxLazyLoadEvent, HxListRole, HxListRowCurrent, HxMenuItem, HxMenuItemCommandEvent, HxMenuPoint, HxMessageSeverity, HxMessageSize, HxMessageVariant, HxMultiSelectDisplay, HxMultiSelectSize, HxMultiSelectVariant, HxPageEvent, HxPrimaryColor, HxPrimaryScale, HxProgressMode, HxQuickSelectLabels, HxQuickSelectRange, HxRadioSize, HxRowClass, HxSelectButtonSize, HxSelectItem, HxSelectSize, HxSelectVariant, HxSelectionMode, HxSkeletonAnimation, HxSkeletonShape, HxSliderOrientation, HxSliderValue, HxSortFirstOrder, HxSortFunction, HxSortMeta, HxSortMode, HxStepContentContext, HxStepValue, HxSurface, HxTabBarItem, HxTabBarMenuItem, HxTabBarMove, HxTabBarReceive, HxTableColumnsContext, HxTableRowContext, HxTableSize, HxTagSeverity, HxThemeOptions, HxThemePreset, HxTimePickerValue, HxTimelineAlign, HxTimelineContext, HxTimelineLayout, HxToastMessage, HxToastMessageInput, HxToastPosition, HxToastSeverity, HxToggleButtonSize, HxTooltipEvent, HxTooltipPosition, HxTreeFilterMode, HxTreeNode, HxTreeNodeContext, HxTreeNodeEvent, HxTreeSelection, HxTreeSelectionMode };