@truenas/ui-components 0.3.8 → 0.3.9

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": "@truenas/ui-components",
3
- "version": "0.3.8",
3
+ "version": "0.3.9",
4
4
  "publishConfig": {
5
5
  "registry": "https://registry.npmjs.org",
6
6
  "access": "public"
@@ -6823,21 +6823,46 @@ declare class TnSliderThumbDirective implements ControlValueAccessor, OnInit, On
6823
6823
  max: () => number;
6824
6824
  step: () => number;
6825
6825
  value: () => number;
6826
+ labelPrefix: () => string;
6827
+ labelSuffix: () => string;
6828
+ ariaLabel: () => string | undefined;
6829
+ ariaLabelledby: () => string | undefined;
6826
6830
  updateValue: (value: number) => void;
6831
+ markTouched: () => void;
6827
6832
  getSliderRect: () => DOMRect;
6828
6833
  };
6829
6834
  onTouched: () => void;
6830
6835
  private onChangeCallback;
6836
+ private isPointerDown;
6831
6837
  private isDragging;
6838
+ private currentValue;
6839
+ private hasWrittenValue;
6832
6840
  private elementRef;
6841
+ private fallbackAriaLabel;
6842
+ private fallbackAriaLabelledby;
6833
6843
  ngOnInit(): void;
6834
6844
  ngOnDestroy(): void;
6845
+ /** Value last written by the form, for the slider to read once linked. */
6846
+ getValue(): number;
6847
+ /**
6848
+ * Whether the form has written a value to this thumb. The slider checks this
6849
+ * before adopting getValue() so an unbound thumb's default 0 never overwrites
6850
+ * a value bound directly on the slider.
6851
+ */
6852
+ hasFormValue(): boolean;
6835
6853
  writeValue(value: number): void;
6836
6854
  registerOnChange(fn: (value: number) => void): void;
6837
6855
  registerOnTouched(fn: () => void): void;
6838
6856
  setDisabledState(isDisabled: boolean): void;
6839
6857
  onInput(event: Event): void;
6840
6858
  onChange(_event: Event): void;
6859
+ /**
6860
+ * Marks the bound control touched. Calls the thumb's own `onTouched` (for a
6861
+ * thumb-bound control) and forwards to the linked slider (for a
6862
+ * slider-host-bound control) — the thumb is the only interactive element, so
6863
+ * the slider relies on it to ever become touched.
6864
+ */
6865
+ notifyTouched(): void;
6841
6866
  onMouseDown(event: MouseEvent): void;
6842
6867
  onTouchStart(event: TouchEvent): void;
6843
6868
  private addGlobalListeners;
@@ -6847,13 +6872,35 @@ declare class TnSliderThumbDirective implements ControlValueAccessor, OnInit, On
6847
6872
  private onGlobalTouchMove;
6848
6873
  private onGlobalTouchEnd;
6849
6874
  private updateValueFromPosition;
6875
+ /**
6876
+ * Resolve the accessible name for the range input: the parent slider's
6877
+ * `aria-label`/`aria-labelledby` input when set, otherwise a value placed
6878
+ * directly on the `<input tnSliderThumb>`. Returning the fallback keeps the
6879
+ * host binding from wiping a directly-set label. Null removes the attribute.
6880
+ */
6881
+ ariaLabel(): string | null;
6882
+ ariaLabelledby(): string | null;
6883
+ /**
6884
+ * Commit a value that originated outside the native input (a thumb drag).
6885
+ * Syncs `currentValue`, the native input, and emits to the form. The slider's
6886
+ * own `onChange` only reaches a slider-bound control, so a thumb-bound control
6887
+ * relies on this to stay in sync. Expects an already clamped/stepped value
6888
+ * (slider.value()).
6889
+ */
6890
+ commit(value: number): void;
6891
+ /**
6892
+ * Builds an aria-valuetext when the slider has a label prefix/suffix so screen
6893
+ * readers announce "50 km/h" rather than the bare number. Returns null when
6894
+ * neither is set, letting the native range's valuenow announcement stand.
6895
+ */
6896
+ ariaValueText(): string | null;
6850
6897
  private cleanup;
6851
6898
  static ɵfac: _angular_core.ɵɵFactoryDeclaration<TnSliderThumbDirective, never>;
6852
6899
  static ɵdir: _angular_core.ɵɵDirectiveDeclaration<TnSliderThumbDirective, "input[tnSliderThumb]", never, {}, {}, never, never, true, never>;
6853
6900
  }
6854
6901
 
6855
6902
  type LabelType = 'none' | 'handle' | 'track' | 'both';
6856
- declare class TnSliderComponent implements ControlValueAccessor, OnDestroy, AfterViewInit {
6903
+ declare class TnSliderComponent implements ControlValueAccessor, OnDestroy, AfterContentInit, AfterViewInit {
6857
6904
  min: _angular_core.InputSignal<number>;
6858
6905
  max: _angular_core.InputSignal<number>;
6859
6906
  step: _angular_core.InputSignal<number>;
@@ -6866,9 +6913,18 @@ declare class TnSliderComponent implements ControlValueAccessor, OnDestroy, Afte
6866
6913
  * is configured via `TN_TEST_ATTR` (default `data-testid`).
6867
6914
  */
6868
6915
  testId: _angular_core.InputSignal<TnTestIdValue>;
6916
+ /**
6917
+ * Accessible name forwarded to the inner range input — the focusable element
6918
+ * screen readers actually announce. Set this (or `aria-labelledby`) when the
6919
+ * slider isn't already labelled by a `tn-form-field`/`<label>`, otherwise a
6920
+ * standalone `<tn-slider><input tnSliderThumb></tn-slider>` announces only
6921
+ * "slider". A label set directly on the `input[tnSliderThumb]` is used as a
6922
+ * fallback when neither is provided here.
6923
+ */
6924
+ ariaLabel: _angular_core.InputSignal<string | undefined>;
6925
+ ariaLabelledby: _angular_core.InputSignal<string | undefined>;
6869
6926
  thumbDirective: _angular_core.Signal<TnSliderThumbDirective>;
6870
6927
  sliderContainer: _angular_core.Signal<ElementRef<HTMLDivElement>>;
6871
- thumbVisual: _angular_core.Signal<ElementRef<HTMLDivElement>>;
6872
6928
  private onChange;
6873
6929
  private onTouched;
6874
6930
  value: _angular_core.WritableSignal<number>;
@@ -6878,30 +6934,35 @@ declare class TnSliderComponent implements ControlValueAccessor, OnDestroy, Afte
6878
6934
  isDisabled: _angular_core.Signal<boolean>;
6879
6935
  fillPercentage: _angular_core.Signal<number>;
6880
6936
  fillScale: _angular_core.Signal<number>;
6881
- thumbPosition: _angular_core.Signal<number>;
6882
6937
  showLabel: _angular_core.Signal<boolean>;
6883
6938
  labelVisible: _angular_core.Signal<boolean>;
6884
6939
  constructor();
6940
+ ngAfterContentInit(): void;
6885
6941
  ngAfterViewInit(): void;
6886
6942
  ngOnDestroy(): void;
6887
6943
  writeValue(value: number): void;
6888
6944
  registerOnChange(fn: (value: number) => void): void;
6889
6945
  registerOnTouched(fn: () => void): void;
6946
+ /**
6947
+ * Marks a slider-host-bound control as touched. The inner thumb is the only
6948
+ * interactive element, so it forwards its touch events here (on blur / pointer
6949
+ * release) — otherwise a control bound to the `tn-slider` host would never
6950
+ * transition to touched and touched-gated validation would never show.
6951
+ */
6952
+ markTouched(): void;
6890
6953
  setDisabledState(isDisabled: boolean): void;
6891
6954
  updateValue(newValue: number): void;
6892
6955
  enableLabel(): void;
6893
6956
  showThumbLabel(): void;
6894
6957
  hideThumbLabel(): void;
6895
6958
  getSliderRect(): DOMRect;
6896
- onTrackClick(event: MouseEvent | TouchEvent): void;
6897
- private updateThumbPosition;
6898
6959
  private clampValue;
6899
6960
  private setupHandleInteractionListeners;
6900
6961
  private cleanupHandleInteractionListeners;
6901
6962
  private onInteractionStart;
6902
6963
  private onInteractionEnd;
6903
6964
  static ɵfac: _angular_core.ɵɵFactoryDeclaration<TnSliderComponent, never>;
6904
- static ɵcmp: _angular_core.ɵɵComponentDeclaration<TnSliderComponent, "tn-slider", never, { "min": { "alias": "min"; "required": false; "isSignal": true; }; "max": { "alias": "max"; "required": false; "isSignal": true; }; "step": { "alias": "step"; "required": false; "isSignal": true; }; "disabled": { "alias": "disabled"; "required": false; "isSignal": true; }; "labelPrefix": { "alias": "labelPrefix"; "required": false; "isSignal": true; }; "labelSuffix": { "alias": "labelSuffix"; "required": false; "isSignal": true; }; "labelType": { "alias": "labelType"; "required": false; "isSignal": true; }; "testId": { "alias": "testId"; "required": false; "isSignal": true; }; }, {}, ["thumbDirective"], ["*"], true, never>;
6965
+ static ɵcmp: _angular_core.ɵɵComponentDeclaration<TnSliderComponent, "tn-slider", never, { "min": { "alias": "min"; "required": false; "isSignal": true; }; "max": { "alias": "max"; "required": false; "isSignal": true; }; "step": { "alias": "step"; "required": false; "isSignal": true; }; "disabled": { "alias": "disabled"; "required": false; "isSignal": true; }; "labelPrefix": { "alias": "labelPrefix"; "required": false; "isSignal": true; }; "labelSuffix": { "alias": "labelSuffix"; "required": false; "isSignal": true; }; "labelType": { "alias": "labelType"; "required": false; "isSignal": true; }; "testId": { "alias": "testId"; "required": false; "isSignal": true; }; "ariaLabel": { "alias": "aria-label"; "required": false; "isSignal": true; }; "ariaLabelledby": { "alias": "aria-labelledby"; "required": false; "isSignal": true; }; }, {}, ["thumbDirective"], ["*"], true, never>;
6905
6966
  }
6906
6967
 
6907
6968
  declare class TnSliderWithLabelDirective implements OnInit, OnDestroy {