@xyo-network/react-form-group 4.1.5 → 4.1.7

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.
@@ -15,6 +15,11 @@ export type FormGroupParams<TStorageValue extends Payload = Payload> = {
15
15
  };
16
16
  ttlStorage?: number;
17
17
  };
18
+ /**
19
+ * Organize form controls in a group.
20
+ *
21
+ * NOTE: This is a work in progress and only supports top level controls. Nested controls are not supported.
22
+ */
18
23
  export declare class FormGroup<TValue extends PayloadWithTimestamp = PayloadWithTimestamp, TStorageValue extends PayloadWithTimestamp = PayloadWithTimestamp> extends AbstractControl {
19
24
  private fgParams?;
20
25
  private _controls;
@@ -1 +1 @@
1
- {"version":3,"file":"FormGroup.d.ts","sourceRoot":"","sources":["../../src/FormGroup.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,4BAA4B,CAAA;AAGzD,OAAO,EAAE,eAAe,EAAE,MAAM,oBAAoB,CAAA;AACpD,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,iBAAiB,CAAA;AACnD,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,oBAAoB,CAAA;AAE1D,MAAM,MAAM,oBAAoB,GAAG,OAAO,CAAC;IAAE,SAAS,CAAC,EAAE,MAAM,CAAA;CAAE,CAAC,CAAA;AAElE,MAAM,MAAM,WAAW,CAAC,CAAC,IAAI,MAAM,CAAC,SAAS,MAAM,GAAG,MAAM,CAAC,GAAG,KAAK,CAAA;AAErE,KAAK,eAAe,CAAC,MAAM,IAAI,MAAM,CAAC,WAAW,CAAC,MAAM,CAAC,EAAE,MAAM,CAAC,CAAA;AAElE,MAAM,MAAM,eAAe,CAAC,aAAa,SAAS,OAAO,GAAG,OAAO,IAAI;IACrE,SAAS,CAAC,EAAE,OAAO,CAAA;IACnB,OAAO,CAAC,EAAE;QACR,SAAS,CAAC,EAAE,gBAAgB,CAAC,aAAa,CAAC,CAAA;QAC3C,OAAO,C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gDAEnB;IAED,IAAa,OAAO,YAEnB;IAED,IAAa,KAAK,YAEjB;IAED,IAAI,MAAM,IAAI,MAAM,CAOnB;IAED,UAAU,CAAC,IAAI,EAAE,MAAM;IAIjB,kBAAkB,CAAC,IAAI,EAAE,MAAM,EAAE,SAAS,UAAQ,GAAG,OAAO,CAAC,MAAM,GAAG,SAAS,CAAC;IAwBtF,eAAe,CAAC,IAAI,EAAE,MAAM,EAAE,OAAO,EAAE,eAAe;IAMtD,aAAa;IAMb,WAAW;IAMX,iBAAiB,CAAC,IAAI,EAAE,MAAM;IAW9B,cAAc,CAAC,cAAc,CAAC,EAAE,MAAM,EAAE,GAAG,SAAS;IAWpD,OAAO,CAAC,qBAAqB;IAuC7B,OAAO,CAAC,eAAe;IAUvB,OAAO,CAAC,wBAAwB;CAcjC"}
@@ -4,5 +4,8 @@ import type { FormGroupParams } from '../FormGroup.ts';
4
4
  export interface FormGroupPayloadProviderProps<TStorage extends Payload = Payload> extends PropsWithChildren {
5
5
  params?: FormGroupParams<TStorage>;
6
6
  }
7
+ /**
8
+ * Provides a FormGroup to child components.
9
+ */
7
10
  export declare const FormGroupPayloadProvider: ({ children, params, ...props }: FormGroupPayloadProviderProps) => import("react/jsx-runtime").JSX.Element;
8
11
  //# sourceMappingURL=Provider.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"Provider.d.ts","sourceRoot":"","sources":["../../../src/context/Provider.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,4BAA4B,CAAA;AACzD,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,OAAO,CAAA;AAG9C,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,iBAAiB,CAAA;AAItD,MAAM,WAAW,6BAA6B,CAAC,QAAQ,SAAS,OAAO,GAAG,OAAO,CAAE,SAAQ,iBAAiB;IAC1G,MAAM,CAAC,EAAE,eAAe,CAAC,QAAQ,CAAC,CAAA;CACnC;AAKD,eAAO,MAAM,wBAAwB,mCAElC,6BAA6B,4CAiB/B,CAAA"}
1
+ {"version":3,"file":"Provider.d.ts","sourceRoot":"","sources":["../../../src/context/Provider.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,4BAA4B,CAAA;AACzD,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,OAAO,CAAA;AAG9C,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,iBAAiB,CAAA;AAItD,MAAM,WAAW,6BAA6B,CAAC,QAAQ,SAAS,OAAO,GAAG,OAAO,CAAE,SAAQ,iBAAiB;IAC1G,MAAM,CAAC,EAAE,eAAe,CAAC,QAAQ,CAAC,CAAA;CACnC;AAED;;GAEG;AACH,eAAO,MAAM,wBAAwB,mCAElC,6BAA6B,4CAiB/B,CAAA"}
@@ -5,15 +5,67 @@ export type AbstractControlEvents<TValue> = ControlValueAccessorBaseEvents<TValu
5
5
  status: FormControlStatus;
6
6
  };
7
7
  };
8
+ /**
9
+ * This is the base class for `Control` classes (i.e. FormControl),
10
+ *
11
+ * It provides some of the shared behavior that all controls and groups of controls have, like
12
+ * running validators, calculating status, and resetting state. It also defines the properties
13
+ * that are shared between all sub-classes, like `value`, `valid`, and `dirty`. It shouldn't be
14
+ * instantiated directly.
15
+ *
16
+ * NOTE: Heavily borrowed from Angular's AbstractControl:
17
+ * https://github.com/angular/angular/blob/5dcdbfcba934a930468aec140a7183b034466bdf/packages/forms/src/model/abstract_model.ts
18
+ */
8
19
  export declare class AbstractControl<TValue extends ValidControlValue = ValidControlValue> extends ControlValueAccessorBase<TValue, AbstractControlEvents<TValue>> {
9
20
  private _status;
10
21
  constructor();
22
+ /**
23
+ * A control is `disabled` when its `status` is `DISABLED`.
24
+ *
25
+ * Disabled controls are exempt from validation checks and
26
+ * are not included in the aggregate value of their ancestor
27
+ * controls.
28
+ *
29
+ * @returns True if the control is disabled, false otherwise.
30
+ */
31
+ /** @deprecated - disabled functionality not implemented */
11
32
  get disabled(): boolean;
33
+ /**
34
+ * A control is `enabled` as long as its `status` is not `DISABLED`.
35
+ *
36
+ * @returns True if the control has any status other than 'DISABLED',
37
+ * false if the status is 'DISABLED'.
38
+ */
12
39
  get enabled(): boolean;
40
+ /**
41
+ * A control is `invalid` when its `status` is `INVALID`.
42
+
43
+ *
44
+ * @returns True if this control has failed one or more of its validation checks,
45
+ * false otherwise.
46
+ */
13
47
  get invalid(): boolean;
48
+ /**
49
+ * A control is `pending` when its `status` is `PENDING`.
50
+ *
51
+ * @returns True if this control is in the process of conducting a validation check,
52
+ * false otherwise.
53
+ */
14
54
  get pending(): boolean;
55
+ /**
56
+ * The raw value of the control.
57
+ */
15
58
  get rawValue(): TValue;
59
+ /**
60
+ * The current status of the control.
61
+ */
16
62
  get status(): FormControlStatus | undefined;
63
+ /**
64
+ * A control is `valid` when its `status` is `VALID`.
65
+ *
66
+ * @returns True if the control has passed all of its validation tests,
67
+ * false otherwise.
68
+ */
17
69
  get valid(): boolean;
18
70
  setErrorAndValidity(error: string, status: FormControlStatus): void;
19
71
  setStatus(status: FormControlStatus): void;
@@ -1 +1 @@
1
- {"version":3,"file":"AbstractControl.d.ts","sourceRoot":"","sources":["../../../src/control/AbstractControl.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EACV,8BAA8B,EAC9B,iBAAiB,EACjB,iBAAiB,EAClB,MAAM,qBAAqB,CAAA;AAC5B,OAAO,EACL,wBAAwB,EAKzB,MAAM,qBAAqB,CAAA;AAE5B,MAAM,MAAM,qBAAqB,CAAC,MAAM,IAAI,8BAA8B,CAAC,MAAM,CAAC,GAAG;IACnF,aAAa,EAAE;QAAE,MAAM,EAAE,iBAAiB,CAAA;KAAE,CAAA;CAC7C,CAAA;AAaD,qBAAa,eAAe,CAAC,MAAM,SAAS,iBAAiB,GAAG,iBAAiB,CAAE,SAAQ,wBAAwB,CACjH,MAAM,EACN,qBAAqB,CAAC,MAAM,CAAC,CAC9B;IACC,OAAO,CAAC,OAAO,CAA2C;;IAg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ACH,IAAI,MAAM,kCAET;IAED;;;;;OAKG;IACH,IAAI,KAAK,IAAI,OAAO,CAEnB;IAED,mBAAmB,CAAC,KAAK,EAAE,MAAM,EAAE,MAAM,EAAE,iBAAiB;IAK5D,SAAS,CAAC,MAAM,EAAE,iBAAiB;IASnC,QAAQ,IAAI,OAAO;CAGpB"}
@@ -2,7 +2,13 @@ import type { EmptyObject } from '@xylabs/object';
2
2
  import { AbstractControl } from './AbstractControl.ts';
3
3
  import type { SetOptions } from './accessor/index.ts';
4
4
  import type { CursorPosition, FormControl } from './FormControl.ts';
5
+ /**
6
+ * A base class for form controls and their validation.
7
+ */
5
8
  export declare abstract class FormControlBase<TProps extends EmptyObject = EmptyObject> extends AbstractControl implements FormControl {
9
+ /**
10
+ * The current and previous cursor position of the input element.
11
+ */
6
12
  cursorPosition: CursorPosition;
7
13
  invalidMessage: string;
8
14
  pattern: RegExp;
@@ -1 +1 @@
1
- {"version":3,"file":"FormControlBase.d.ts","sourceRoot":"","sources":["../../../src/control/FormControlBase.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,gBAAgB,CAAA;AAEjD,OAAO,EAAE,eAAe,EAAE,MAAM,sBAAsB,CAAA;AACtD,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,qBAAqB,CAAA;AACrD,OAAO,KAAK,EAAE,cAAc,EAAE,WAAW,EAAE,MAAM,kBAAkB,CAAA;AAOnE,8BAAsB,eAAe,CAAC,MAAM,SAAS,WAAW,GAAG,WAAW,CAAE,SAAQ,eAAgB,YAAW,WAAW;IAI5H,cAAc,EAAE,cAAc,CAA8C;IAE5E,cAAc,SAAkB;IAChC,OAAO,SAAgB;IACvB,aAAa,SAAgB;IAC7B,KAAK,EAAS,MAAM,CAAA;IACpB,QAAQ,UAAQ;IAEhB,OAAO,CAAC,KAAK,CAAgC;;IAM7C,IAAI,IAAI,uBAEP;IAED,IAAa,QAAQ,gEAEpB;IAED,SAAS,CAAC,CAAC,K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C,CAAC,KAAK,EAAE,MAAM,GAAG,IAAI;IACjC,iBAAiB,CAAC,IAAI,MAAM,GAAG,SAAS;IACxC,IAAI,CAAC,CAAC,KAAK,EAAE,MAAM,GAAG,MAAM;IAC5B,cAAc,EAAE,CAAC,MAAM,EAAE,MAAM,GAAG,SAAS,KAAK,IAAI,CAAW;IAEtD,QAAQ,CAAC,KAAK,EAAE,MAAM,YAAK,EAAE,UAAU,EAAE,UAAU;IA0B5D,MAAM,CAAC,CAAC,KAAK,EAAE,MAAM,GAAG,MAAM;IAGrB,QAAQ,IAAI,OAAO;IAQ5B,SAAS,CAAC,OAAO,CAAC,IAAI,EAAE,MAAM,GAAG,SAAS;CAG3C"}
@@ -17,6 +17,9 @@ export type ControlValueAccessorBaseEvents<TValue = ValidControlValue> = {
17
17
  value: TValue;
18
18
  };
19
19
  };
20
+ /**
21
+ * The base class for control value accessors interface
22
+ */
20
23
  export declare class ControlValueAccessorBase<TValue = ValidControlValue, TEventData extends ControlValueAccessorBaseEvents<TValue> = ControlValueAccessorBaseEvents<TValue>> extends BaseEmitter<BaseParams, TEventData> implements ControlValueAccessor<TValue> {
21
24
  private config;
22
25
  private _error;
@@ -25,21 +28,82 @@ export declare class ControlValueAccessorBase<TValue = ValidControlValue, TEvent
25
28
  private _touched;
26
29
  private _value;
27
30
  constructor(config: ControlValueAccessorBaseConfig);
31
+ /**
32
+ * The error message for the control.
33
+ */
28
34
  get error(): string;
35
+ /**
36
+ * The "previous value" of the input element.
37
+ */
29
38
  get previousValue(): TValue;
39
+ /**
40
+ * The serialize settings of the input element.
41
+ */
30
42
  get serializeSettings(): ControlSerializeSettings;
43
+ /**
44
+ * The "touched" state of the input element.
45
+ */
31
46
  get touched(): boolean;
47
+ /**
48
+ * The current value of the input element.
49
+ */
32
50
  get value(): TValue;
51
+ /**
52
+ * The registered callback function called when a change or input event occurs on the input
53
+ * element.
54
+ */
33
55
  onChange: (_: TValue) => void;
56
+ /**
57
+ * Registers a function called when the control error changes.
58
+ */
34
59
  onErrorChange: (error: string) => void;
60
+ /**
61
+ * The registered callback function called when a blur event occurs on the input element.
62
+ */
35
63
  onTouched: (_isTouched: boolean) => void;
64
+ /**
65
+ * Registers a function called when the control value changes.
66
+ * @param {(_value:ValidControlValue)=>void} fn
67
+ * @returns void
68
+ */
36
69
  registerOnChange(fn: (_value: TValue) => void): void;
70
+ /**
71
+ * Registers a function called when the control error changes.
72
+ * @param {(error:string)=>void} fn
73
+ */
37
74
  registerOnErrorChange(fn: (error: string) => void): void;
75
+ /**
76
+ * Registers a function called when the control is touched.
77
+ * @param {(isTouched:boolean)=>void} fn
78
+ * @returns void
79
+ */
38
80
  registerOnTouched(fn: (isTouched: boolean) => void): void;
81
+ /**
82
+ * Sets the "touched" state of the input element.
83
+ * @param {boolean} isTouched
84
+ */
39
85
  setTouched(isTouched: boolean): void;
86
+ /**
87
+ * Sets the "value" property on the input element.
88
+ * @param {ValidControlValue} value
89
+ * @returns void
90
+ */
40
91
  setValue(value: TValue, options?: SetOptions): void;
92
+ /**
93
+ * Set the error message for the control.
94
+ * @param {string} error
95
+ */
41
96
  protected setError(error: string): void;
97
+ /**
98
+ * Sets the "previous value" of the input element.
99
+ * @param {ValidControlValue} value
100
+ * @returns void
101
+ */
42
102
  protected setPreviousValue(value: TValue): void;
103
+ /**
104
+ * Sets the serialize settings of the input element.
105
+ * @param {ControlSerializeSettings} settings
106
+ */
43
107
  protected setSerializeSettings(settings: ControlSerializeSettings): void;
44
108
  }
45
109
  //# sourceMappingURL=ControlValueAccessorBase.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"ControlValueAccessorBase.d.ts","sourceRoot":"","sources":["../../../../src/control/accessor/ControlValueAccessorBase.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,gBAAgB,CAAA;AAChD,OAAO,EAAE,WAAW,EAAE,MAAM,8BAA8B,CAAA;AAE1D,OAAO,KAAK,EACV,wBAAwB,EAAE,oBAAoB,EAAE,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,gBAAgB,CAAC,KAAK,EAAE,MAAM,GAAG,IAAI;IAI/C;;;OAGG;IACH,SAAS,CAAC,oBAAoB,CAAC,QAAQ,EAAE,wBAAwB;CAGlE"}
@@ -1,6 +1,33 @@
1
+ /**
2
+ * Reports that a control is valid, meaning that no errors exist in the input value.
3
+ */
1
4
  export declare const VALID: "VALID";
5
+ /**
6
+ * Reports that a control is invalid, meaning that an error exists in the input value.
7
+ */
2
8
  export declare const INVALID: "INVALID";
9
+ /**
10
+ * Reports that a control is pending, meaning that async validation is occurring and
11
+ * errors are not yet available for the input value.
12
+ */
3
13
  export declare const PENDING: "PENDING";
14
+ /**
15
+ * Reports that a control is disabled, meaning that the control is exempt from ancestor
16
+ * calculations of validity or value.
17
+ */
4
18
  export declare const DISABLED: "DISABLED";
19
+ /**
20
+ * A control can have several different statuses. Each
21
+ * possible status is returned as a string literal.
22
+ *
23
+ * * **VALID**: Reports that a control is valid, meaning that no errors exist in the input
24
+ * value.
25
+ * * **INVALID**: Reports that a control is invalid, meaning that an error exists in the input
26
+ * value.
27
+ * * **PENDING**: Reports that a control is pending, meaning that async validation is
28
+ * occurring and errors are not yet available for the input value.
29
+ * * **DISABLED**: Reports that a control is
30
+ * disabled, meaning that the control is exempt from ancestor calculations of validity or value.
31
+ */
5
32
  export type FormControlStatus = typeof VALID | typeof INVALID | typeof PENDING | typeof DISABLED;
6
33
  //# sourceMappingURL=FormControlStatus.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"FormControlStatus.d.ts","sourceRoot":"","sources":["../../../../src/control/accessor/FormControlStatus.ts"],"names":[],"mappings":"AAGA,eAAO,MAAM,KAAK,SAAmB,CAAA;AAKrC,eAAO,MAAM,OAAO,WAAqB,CAAA;AAMzC,eAAO,MAAM,OAAO,WAAqB,CAAA;AAMzC,eAAO,MAAM,QAAQ,YAAsB,CAAA;AAe3C,MAAM,MAAM,iBAAiB,GAAG,OAAO,KAAK,GAAG,OAAO,OAAO,GAAG,OAAO,OAAO,GAAG,OAAO,QAAQ,CAAA"}
1
+ {"version":3,"file":"FormControlStatus.d.ts","sourceRoot":"","sources":["../../../../src/control/accessor/FormControlStatus.ts"],"names":[],"mappings":"AAAA;;GAEG;AACH,eAAO,MAAM,KAAK,SAAmB,CAAA;AAErC;;GAEG;AACH,eAAO,MAAM,OAAO,WAAqB,CAAA;AAEzC;;;GAGG;AACH,eAAO,MAAM,OAAO,WAAqB,CAAA;AAEzC;;;GAGG;AACH,eAAO,MAAM,QAAQ,YAAsB,CAAA;AAE3C;;;;;;;;;;;;GAYG;AACH,MAAM,MAAM,iBAAiB,GAAG,OAAO,KAAK,GAAG,OAAO,OAAO,GAAG,OAAO,OAAO,GAAG,OAAO,QAAQ,CAAA"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@xyo-network/react-form-group",
3
- "version": "4.1.5",
3
+ "version": "4.1.7",
4
4
  "description": "Common React library for all XYO projects that use React",
5
5
  "keywords": [
6
6
  "xyo",
@@ -43,22 +43,22 @@
43
43
  "lint-pkg": "npmPkgJsonLint ."
44
44
  },
45
45
  "dependencies": {
46
- "@mui/icons-material": "^6.1.4",
47
- "@xylabs/forget": "^4.2.2",
48
- "@xylabs/object": "^4.2.2",
49
- "@xylabs/promise": "^4.2.2",
46
+ "@mui/icons-material": "^6.1.5",
47
+ "@xylabs/forget": "^4.3.2",
48
+ "@xylabs/object": "^4.3.2",
49
+ "@xylabs/promise": "^4.3.2",
50
50
  "@xyo-network/archivist-model": "^3.3.0",
51
51
  "@xyo-network/module-abstract": "^3.3.0",
52
52
  "@xyo-network/module-events": "^3.3.0",
53
53
  "@xyo-network/payload-model": "^3.3.0",
54
- "@xyo-network/react-shared": "^4.1.5"
54
+ "@xyo-network/react-shared": "^4.1.7"
55
55
  },
56
56
  "devDependencies": {
57
- "@mui/material": "^6.1.4",
58
- "@mui/styles": "^6.1.4",
57
+ "@mui/material": "^6.1.5",
58
+ "@mui/styles": "^6.1.5",
59
59
  "@storybook/react": "^8.3.6",
60
- "@xylabs/ts-scripts-yarn3": "^4.2.1",
61
- "@xylabs/tsconfig-react": "^4.2.1",
60
+ "@xylabs/ts-scripts-yarn3": "^4.2.3",
61
+ "@xylabs/tsconfig-react": "^4.2.3",
62
62
  "react": "^18.3.1",
63
63
  "react-dom": "^18.3.1",
64
64
  "storybook": "^8.3.6",