@truenas/ui-components 0.3.7 → 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.7",
3
+ "version": "0.3.9",
4
4
  "publishConfig": {
5
5
  "registry": "https://registry.npmjs.org",
6
6
  "access": "public"
@@ -1252,6 +1252,14 @@ declare class TnIconComponent {
1252
1252
  private sanitizer;
1253
1253
  constructor();
1254
1254
  hostDimension: _angular_core.Signal<string | null>;
1255
+ /**
1256
+ * Inline min-width/min-height override for the custom/full-size paths.
1257
+ * - customSize: pin the minimum to the custom value so flex layouts can't
1258
+ * squish it (mirrors the preset min-* rules in the stylesheet).
1259
+ * - fullSize: relax the minimum to 0 so the icon can shrink with its
1260
+ * container instead of being clamped by the `size` attribute's preset min.
1261
+ */
1262
+ hostMinDimension: _angular_core.Signal<string | null>;
1255
1263
  hostFontSize: _angular_core.Signal<string | null>;
1256
1264
  effectiveAriaLabel: _angular_core.Signal<string>;
1257
1265
  sanitizedContent: _angular_core.Signal<SafeHtml>;
@@ -6815,21 +6823,46 @@ declare class TnSliderThumbDirective implements ControlValueAccessor, OnInit, On
6815
6823
  max: () => number;
6816
6824
  step: () => number;
6817
6825
  value: () => number;
6826
+ labelPrefix: () => string;
6827
+ labelSuffix: () => string;
6828
+ ariaLabel: () => string | undefined;
6829
+ ariaLabelledby: () => string | undefined;
6818
6830
  updateValue: (value: number) => void;
6831
+ markTouched: () => void;
6819
6832
  getSliderRect: () => DOMRect;
6820
6833
  };
6821
6834
  onTouched: () => void;
6822
6835
  private onChangeCallback;
6836
+ private isPointerDown;
6823
6837
  private isDragging;
6838
+ private currentValue;
6839
+ private hasWrittenValue;
6824
6840
  private elementRef;
6841
+ private fallbackAriaLabel;
6842
+ private fallbackAriaLabelledby;
6825
6843
  ngOnInit(): void;
6826
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;
6827
6853
  writeValue(value: number): void;
6828
6854
  registerOnChange(fn: (value: number) => void): void;
6829
6855
  registerOnTouched(fn: () => void): void;
6830
6856
  setDisabledState(isDisabled: boolean): void;
6831
6857
  onInput(event: Event): void;
6832
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;
6833
6866
  onMouseDown(event: MouseEvent): void;
6834
6867
  onTouchStart(event: TouchEvent): void;
6835
6868
  private addGlobalListeners;
@@ -6839,13 +6872,35 @@ declare class TnSliderThumbDirective implements ControlValueAccessor, OnInit, On
6839
6872
  private onGlobalTouchMove;
6840
6873
  private onGlobalTouchEnd;
6841
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;
6842
6897
  private cleanup;
6843
6898
  static ɵfac: _angular_core.ɵɵFactoryDeclaration<TnSliderThumbDirective, never>;
6844
6899
  static ɵdir: _angular_core.ɵɵDirectiveDeclaration<TnSliderThumbDirective, "input[tnSliderThumb]", never, {}, {}, never, never, true, never>;
6845
6900
  }
6846
6901
 
6847
6902
  type LabelType = 'none' | 'handle' | 'track' | 'both';
6848
- declare class TnSliderComponent implements ControlValueAccessor, OnDestroy, AfterViewInit {
6903
+ declare class TnSliderComponent implements ControlValueAccessor, OnDestroy, AfterContentInit, AfterViewInit {
6849
6904
  min: _angular_core.InputSignal<number>;
6850
6905
  max: _angular_core.InputSignal<number>;
6851
6906
  step: _angular_core.InputSignal<number>;
@@ -6858,9 +6913,18 @@ declare class TnSliderComponent implements ControlValueAccessor, OnDestroy, Afte
6858
6913
  * is configured via `TN_TEST_ATTR` (default `data-testid`).
6859
6914
  */
6860
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>;
6861
6926
  thumbDirective: _angular_core.Signal<TnSliderThumbDirective>;
6862
6927
  sliderContainer: _angular_core.Signal<ElementRef<HTMLDivElement>>;
6863
- thumbVisual: _angular_core.Signal<ElementRef<HTMLDivElement>>;
6864
6928
  private onChange;
6865
6929
  private onTouched;
6866
6930
  value: _angular_core.WritableSignal<number>;
@@ -6870,30 +6934,35 @@ declare class TnSliderComponent implements ControlValueAccessor, OnDestroy, Afte
6870
6934
  isDisabled: _angular_core.Signal<boolean>;
6871
6935
  fillPercentage: _angular_core.Signal<number>;
6872
6936
  fillScale: _angular_core.Signal<number>;
6873
- thumbPosition: _angular_core.Signal<number>;
6874
6937
  showLabel: _angular_core.Signal<boolean>;
6875
6938
  labelVisible: _angular_core.Signal<boolean>;
6876
6939
  constructor();
6940
+ ngAfterContentInit(): void;
6877
6941
  ngAfterViewInit(): void;
6878
6942
  ngOnDestroy(): void;
6879
6943
  writeValue(value: number): void;
6880
6944
  registerOnChange(fn: (value: number) => void): void;
6881
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;
6882
6953
  setDisabledState(isDisabled: boolean): void;
6883
6954
  updateValue(newValue: number): void;
6884
6955
  enableLabel(): void;
6885
6956
  showThumbLabel(): void;
6886
6957
  hideThumbLabel(): void;
6887
6958
  getSliderRect(): DOMRect;
6888
- onTrackClick(event: MouseEvent | TouchEvent): void;
6889
- private updateThumbPosition;
6890
6959
  private clampValue;
6891
6960
  private setupHandleInteractionListeners;
6892
6961
  private cleanupHandleInteractionListeners;
6893
6962
  private onInteractionStart;
6894
6963
  private onInteractionEnd;
6895
6964
  static ɵfac: _angular_core.ɵɵFactoryDeclaration<TnSliderComponent, never>;
6896
- 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>;
6897
6966
  }
6898
6967
 
6899
6968
  declare class TnSliderWithLabelDirective implements OnInit, OnDestroy {