@remoteoss/json-schema-form 0.1.1-dev.20230616080231 → 0.1.1-dev.20230616083258

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,22 +1,21 @@
1
1
  /**
2
2
  * Shorthand to lookup for keys with `x-jsf-*` preffix.
3
3
  */
4
- export function pickXKey(node: Object, key: 'presentation' | 'error-message'): Object | undefined
5
-
4
+ export function pickXKey(node: Object, key: 'presentation' | 'error-message'): Object | undefined;
6
5
 
7
6
  type JSConfig = {
8
7
  initialValues?: Record<string, unknown>;
9
8
  strictInputType?: boolean;
10
9
  customProperties?: {
11
- description: () => void | string;
10
+ description: Function | string;
12
11
  [key: string]: unknown;
13
- }
12
+ };
14
13
  inputTypes?: {
15
14
  errorMessage: Record<string, unknown>;
16
- }
17
- }
15
+ };
16
+ };
18
17
 
19
- type Fields = any; // TODO: We don't know what type we have here, we need to investigate
18
+ type Fields = Record<string, unknown>[]; // TODO: We don't know what type we have here, we need to investigate
20
19
 
21
20
  type $TsFixMe = any;
22
21
 
@@ -25,5 +24,25 @@ type $TsFixMe = any;
25
24
  * These fields must be the same from
26
25
  * const { fields } = createHeadlessForm()
27
26
  */
27
+ export function buildCompleteYupSchema(fields: Fields, config: JSConfig): $TsFixMe; // TODO: We don't what yup returns here, we'll fix it later
28
+
29
+ type HeadlessFormOutput =
30
+ | {
31
+ fields: Fields;
32
+ handleValidation: Function;
33
+ isError: boolean;
34
+ error?: undefined;
35
+ }
36
+ | {
37
+ fields: never[];
38
+ isError: boolean;
39
+ error: any;
40
+ };
28
41
 
29
- export function buildCompleteYupSchema(fields: Fields, config: JSConfig): $TsFixMe // TODO: We don't what yup returns here, we'll fix it later
42
+ /**
43
+ * Generates the Headless form based on the provided JSON schema
44
+ */
45
+ export function createHeadlessForm(
46
+ jsonSchema: Record<string, unknown>,
47
+ customConfig: JSConfig = {}
48
+ ): HeadlessFormOutput;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@remoteoss/json-schema-form",
3
- "version": "0.1.1-dev.20230616080231",
3
+ "version": "0.1.1-dev.20230616083258",
4
4
  "description": "Headless UI form powered by JSON Schemas",
5
5
  "author": "Remote.com <engineering@remote.com> (https://remote.com/)",
6
6
  "license": "MIT",