@metamask/snaps-sdk 3.0.0 → 3.1.0
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/CHANGELOG.md +12 -1
- package/dist/index.js +16 -81
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +16 -3
- package/dist/index.mjs.map +1 -1
- package/dist/tsconfig.build.tsbuildinfo +1 -1
- package/dist/types/types/handlers/user-input.d.ts +17 -2
- package/dist/types/ui/components/form.d.ts +7 -0
- package/dist/types/ui/components/input.d.ts +6 -0
- package/dist/types/ui/components/panel.d.ts +10 -0
- package/package.json +2 -2
|
@@ -13,6 +13,7 @@ export declare const InputStruct: import("superstruct").Struct<{
|
|
|
13
13
|
type: NodeType.Input;
|
|
14
14
|
name: string;
|
|
15
15
|
value?: string | undefined;
|
|
16
|
+
error?: string | undefined;
|
|
16
17
|
label?: string | undefined;
|
|
17
18
|
inputType?: "number" | "text" | "password" | undefined;
|
|
18
19
|
placeholder?: string | undefined;
|
|
@@ -23,6 +24,7 @@ export declare const InputStruct: import("superstruct").Struct<{
|
|
|
23
24
|
inputType: import("superstruct").Struct<"number" | "text" | "password" | undefined, null>;
|
|
24
25
|
placeholder: import("superstruct").Struct<string | undefined, null>;
|
|
25
26
|
label: import("superstruct").Struct<string | undefined, null>;
|
|
27
|
+
error: import("superstruct").Struct<string | undefined, null>;
|
|
26
28
|
}>;
|
|
27
29
|
/**
|
|
28
30
|
* An input node, that renders an input.
|
|
@@ -33,6 +35,7 @@ export declare const InputStruct: import("superstruct").Struct<{
|
|
|
33
35
|
* @property inputType - An optional type, either `text`, `password` or `number`.
|
|
34
36
|
* @property placeholder - An optional input placeholder.
|
|
35
37
|
* @property label - An optional input label.
|
|
38
|
+
* @property error - An optional error text.
|
|
36
39
|
*/
|
|
37
40
|
export declare type Input = Infer<typeof InputStruct>;
|
|
38
41
|
/**
|
|
@@ -45,6 +48,7 @@ export declare type Input = Infer<typeof InputStruct>;
|
|
|
45
48
|
* @param args.inputType - An optional type, either `text`, `password` or `number`.
|
|
46
49
|
* @param args.placeholder - An optional input placeholder.
|
|
47
50
|
* @param args.label - An optional input label.
|
|
51
|
+
* @param args.error - An optional error text.
|
|
48
52
|
* @returns The input node as an object.
|
|
49
53
|
* @example
|
|
50
54
|
* const node = input('myInput');
|
|
@@ -56,6 +60,7 @@ export declare const input: (...args: (string | undefined)[] | [Omit<{
|
|
|
56
60
|
type: NodeType.Input;
|
|
57
61
|
name: string;
|
|
58
62
|
value?: string | undefined;
|
|
63
|
+
error?: string | undefined;
|
|
59
64
|
label?: string | undefined;
|
|
60
65
|
inputType?: "number" | "text" | "password" | undefined;
|
|
61
66
|
placeholder?: string | undefined;
|
|
@@ -63,6 +68,7 @@ export declare const input: (...args: (string | undefined)[] | [Omit<{
|
|
|
63
68
|
type: NodeType.Input;
|
|
64
69
|
name: string;
|
|
65
70
|
value?: string | undefined;
|
|
71
|
+
error?: string | undefined;
|
|
66
72
|
label?: string | undefined;
|
|
67
73
|
inputType?: "number" | "text" | "password" | undefined;
|
|
68
74
|
placeholder?: string | undefined;
|
|
@@ -45,6 +45,7 @@ export declare const ParentStruct: Struct<{
|
|
|
45
45
|
type: NodeType.Input;
|
|
46
46
|
name: string;
|
|
47
47
|
value?: string | undefined;
|
|
48
|
+
error?: string | undefined;
|
|
48
49
|
label?: string | undefined;
|
|
49
50
|
inputType?: "number" | "text" | "password" | undefined;
|
|
50
51
|
placeholder?: string | undefined;
|
|
@@ -61,6 +62,7 @@ export declare const ParentStruct: Struct<{
|
|
|
61
62
|
type: NodeType.Input;
|
|
62
63
|
name: string;
|
|
63
64
|
value?: string | undefined;
|
|
65
|
+
error?: string | undefined;
|
|
64
66
|
label?: string | undefined;
|
|
65
67
|
inputType?: "number" | "text" | "password" | undefined;
|
|
66
68
|
placeholder?: string | undefined;
|
|
@@ -113,6 +115,7 @@ export declare const ParentStruct: Struct<{
|
|
|
113
115
|
type: NodeType.Input;
|
|
114
116
|
name: string;
|
|
115
117
|
value?: string | undefined;
|
|
118
|
+
error?: string | undefined;
|
|
116
119
|
label?: string | undefined;
|
|
117
120
|
inputType?: "number" | "text" | "password" | undefined;
|
|
118
121
|
placeholder?: string | undefined;
|
|
@@ -129,6 +132,7 @@ export declare const ParentStruct: Struct<{
|
|
|
129
132
|
type: NodeType.Input;
|
|
130
133
|
name: string;
|
|
131
134
|
value?: string | undefined;
|
|
135
|
+
error?: string | undefined;
|
|
132
136
|
label?: string | undefined;
|
|
133
137
|
inputType?: "number" | "text" | "password" | undefined;
|
|
134
138
|
placeholder?: string | undefined;
|
|
@@ -179,6 +183,7 @@ export declare const ParentStruct: Struct<{
|
|
|
179
183
|
type: NodeType.Input;
|
|
180
184
|
name: string;
|
|
181
185
|
value?: string | undefined;
|
|
186
|
+
error?: string | undefined;
|
|
182
187
|
label?: string | undefined;
|
|
183
188
|
inputType?: "number" | "text" | "password" | undefined;
|
|
184
189
|
placeholder?: string | undefined;
|
|
@@ -195,6 +200,7 @@ export declare const ParentStruct: Struct<{
|
|
|
195
200
|
type: NodeType.Input;
|
|
196
201
|
name: string;
|
|
197
202
|
value?: string | undefined;
|
|
203
|
+
error?: string | undefined;
|
|
198
204
|
label?: string | undefined;
|
|
199
205
|
inputType?: "number" | "text" | "password" | undefined;
|
|
200
206
|
placeholder?: string | undefined;
|
|
@@ -293,6 +299,7 @@ export declare const panel: (...args: [Omit<Panel, "type">] | ({
|
|
|
293
299
|
type: NodeType.Input;
|
|
294
300
|
name: string;
|
|
295
301
|
value?: string | undefined;
|
|
302
|
+
error?: string | undefined;
|
|
296
303
|
label?: string | undefined;
|
|
297
304
|
inputType?: "number" | "text" | "password" | undefined;
|
|
298
305
|
placeholder?: string | undefined;
|
|
@@ -309,6 +316,7 @@ export declare const panel: (...args: [Omit<Panel, "type">] | ({
|
|
|
309
316
|
type: NodeType.Input;
|
|
310
317
|
name: string;
|
|
311
318
|
value?: string | undefined;
|
|
319
|
+
error?: string | undefined;
|
|
312
320
|
label?: string | undefined;
|
|
313
321
|
inputType?: "number" | "text" | "password" | undefined;
|
|
314
322
|
placeholder?: string | undefined;
|
|
@@ -360,6 +368,7 @@ export declare const ComponentStruct: Struct<{
|
|
|
360
368
|
type: NodeType.Input;
|
|
361
369
|
name: string;
|
|
362
370
|
value?: string | undefined;
|
|
371
|
+
error?: string | undefined;
|
|
363
372
|
label?: string | undefined;
|
|
364
373
|
inputType?: "number" | "text" | "password" | undefined;
|
|
365
374
|
placeholder?: string | undefined;
|
|
@@ -376,6 +385,7 @@ export declare const ComponentStruct: Struct<{
|
|
|
376
385
|
type: NodeType.Input;
|
|
377
386
|
name: string;
|
|
378
387
|
value?: string | undefined;
|
|
388
|
+
error?: string | undefined;
|
|
379
389
|
label?: string | undefined;
|
|
380
390
|
inputType?: "number" | "text" | "password" | undefined;
|
|
381
391
|
placeholder?: string | undefined;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@metamask/snaps-sdk",
|
|
3
|
-
"version": "3.
|
|
3
|
+
"version": "3.1.0",
|
|
4
4
|
"repository": {
|
|
5
5
|
"type": "git",
|
|
6
6
|
"url": "https://github.com/MetaMask/snaps.git"
|
|
@@ -46,7 +46,7 @@
|
|
|
46
46
|
"superstruct": "^1.0.3"
|
|
47
47
|
},
|
|
48
48
|
"devDependencies": {
|
|
49
|
-
"@lavamoat/allow-scripts": "^3.0.
|
|
49
|
+
"@lavamoat/allow-scripts": "^3.0.3",
|
|
50
50
|
"@metamask/auto-changelog": "^3.4.4",
|
|
51
51
|
"@metamask/eslint-config": "^12.1.0",
|
|
52
52
|
"@metamask/eslint-config-jest": "^12.1.0",
|