@momentum-ui/web-components 2.23.17 → 2.23.18

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.
@@ -24,6 +24,7 @@ export declare namespace CardV2 {
24
24
  createdTime: number;
25
25
  active: boolean;
26
26
  expandable: boolean;
27
+ expandAriaLabel: string;
27
28
  private interval;
28
29
  private renderedData;
29
30
  connectedCallback(): void;
@@ -1,3 +1,6 @@
1
+ export interface Subscription {
2
+ unsubscribe(): void;
3
+ }
1
4
  export type ValidationError = {
2
5
  type: string;
3
6
  count?: number;
@@ -7,4 +10,7 @@ export interface AbstractControl<ControlValue = unknown> {
7
10
  readonly value: ControlValue;
8
11
  readonly valid: boolean;
9
12
  validate(): void;
13
+ onChange?: (listener: (control: AbstractControl<ControlValue>) => void) => Subscription;
14
+ markAsTouched?(): void;
15
+ markAllAsTouched?(): void;
10
16
  }
@@ -1,5 +1,6 @@
1
1
  import { AbstractControl } from "./Form.types";
2
- export declare class FormArray<ItemType> implements AbstractControl<ItemType[]> {
2
+ import { ObservableControl } from "./ObservableControl";
3
+ export declare class FormArray<ItemType> extends ObservableControl<ItemType[]> implements AbstractControl<ItemType[]> {
3
4
  private readonly controls;
4
5
  constructor(controls: AbstractControl<ItemType>[]);
5
6
  at(index: number): AbstractControl<ItemType>;
@@ -10,4 +11,5 @@ export declare class FormArray<ItemType> implements AbstractControl<ItemType[]>
10
11
  get length(): number;
11
12
  getControls(): AbstractControl<ItemType>[];
12
13
  validate(): void;
14
+ markAllAsTouched(): void;
13
15
  }
@@ -1,10 +1,14 @@
1
1
  import { AbstractControl, ValidationError, ValidatorFn } from "./Form.types";
2
- export declare class FormControl<ValueType> implements AbstractControl<ValueType> {
2
+ import { ObservableControl } from "./ObservableControl";
3
+ export type ControlListener<ValueType> = (control: AbstractControl<ValueType>) => void;
4
+ export declare class FormControl<ValueType> extends ObservableControl<ValueType> implements AbstractControl<ValueType> {
3
5
  private currentValue;
4
6
  private validationErrors;
7
+ private touched;
5
8
  private readonly validators;
6
9
  constructor(initialValue: ValueType, validators?: ValidatorFn<ValueType>[]);
7
10
  get value(): ValueType;
11
+ markAsTouched(): void;
8
12
  get valid(): boolean;
9
13
  get errors(): ValidationError[];
10
14
  setValue(value: ValueType): void;
@@ -1,7 +1,8 @@
1
1
  import { AbstractControl } from "./Form.types";
2
2
  import { FormArray } from "./FormArray";
3
3
  import { FormControl } from "./FormControl";
4
- export declare class FormGroup<FormValues extends Record<string, unknown>> implements AbstractControl<FormValues> {
4
+ import { ObservableControl } from "./ObservableControl";
5
+ export declare class FormGroup<FormValues extends Record<string, unknown>> extends ObservableControl<FormValues> implements AbstractControl<FormValues> {
5
6
  private readonly controls;
6
7
  constructor(controls: {
7
8
  [Field in keyof FormValues]: AbstractControl<FormValues[Field]>;
@@ -10,4 +11,5 @@ export declare class FormGroup<FormValues extends Record<string, unknown>> imple
10
11
  get value(): FormValues;
11
12
  get valid(): boolean;
12
13
  validate(): void;
14
+ markAllAsTouched(): void;
13
15
  }
@@ -0,0 +1,11 @@
1
+ import { AbstractControl } from "./Form.types";
2
+ export declare abstract class ObservableControl<Value> implements AbstractControl<Value> {
3
+ private listeners;
4
+ onChange(listener: (control: AbstractControl<Value>) => void): {
5
+ unsubscribe: () => void;
6
+ };
7
+ protected emitChange(): void;
8
+ abstract get value(): Value;
9
+ abstract get valid(): boolean;
10
+ abstract validate(): void;
11
+ }
@@ -0,0 +1,6 @@
1
+ export { FormControl } from './FormControl';
2
+ export { FormGroup } from './FormGroup';
3
+ export { FormArray } from './FormArray';
4
+ export { Validators } from './validators';
5
+ export { AbstractControl } from './Form.types';
6
+ export { ValidationError } from './Form.types';
@@ -10,6 +10,7 @@ import "@/components/icon/Icon";
10
10
  import "@/components/label/Label";
11
11
  import "@/components/spinner/Spinner";
12
12
  import { LitElement } from "lit-element";
13
+ import { FormControl } from "../form";
13
14
  export declare const containerSize: string[];
14
15
  export declare const inputSize: string[];
15
16
  export declare const inputType: string[];
@@ -77,6 +78,7 @@ export declare namespace Input {
77
78
  ariaControls: string;
78
79
  ariaExpanded: string;
79
80
  newMomentum: boolean;
81
+ control?: FormControl<unknown>;
80
82
  input: HTMLInputElement;
81
83
  private isEditing;
82
84
  private readonly inputSectionRightSlot;
@@ -84,4 +84,5 @@ export { ToggleSwitch } from "./components/toggle-switch/ToggleSwitch";
84
84
  export { Tooltip } from "./components/tooltip/Tooltip";
85
85
  export { iconUrlManager } from "./managers/IconUrlManager";
86
86
  export { ThemeManager, themeManager } from "./managers/ThemeManager";
87
+ export { FormGroup, FormArray, FormControl, Validators, AbstractControl, ValidationError } from "./components/form";
87
88
  export type { Events, IPopoverController, PopoverColor, PopoverPlacement, PopoverStrategy, PopoverTrigger } from "./components/popover/Popover.types";
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@momentum-ui/web-components",
3
- "version": "2.23.17",
3
+ "version": "2.23.18",
4
4
  "author": "Yana Harris",
5
5
  "license": "MIT",
6
6
  "repository": "https://github.com/momentum-design/momentum-ui.git",