@metamask/snaps-sdk 6.2.0 → 6.3.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/dist/jsx/index.js CHANGED
@@ -38,6 +38,8 @@ __export(jsx_exports, {
38
38
  Form: () => Form,
39
39
  FormChildStruct: () => FormChildStruct,
40
40
  Heading: () => Heading,
41
+ Icon: () => Icon,
42
+ IconName: () => IconName,
41
43
  Image: () => Image,
42
44
  Input: () => Input,
43
45
  Italic: () => Italic,
@@ -48,6 +50,8 @@ __export(jsx_exports, {
48
50
  RadioGroup: () => RadioGroup,
49
51
  RootJSXElementStruct: () => RootJSXElementStruct,
50
52
  Row: () => Row,
53
+ Selector: () => Selector,
54
+ SelectorOption: () => SelectorOption,
51
55
  Spinner: () => Spinner,
52
56
  Text: () => Text,
53
57
  Tooltip: () => Tooltip,
@@ -121,73 +125,245 @@ var Form = createSnapComponent(TYPE9);
121
125
  var TYPE10 = "Input";
122
126
  var Input = createSnapComponent(TYPE10);
123
127
 
128
+ // src/jsx/components/form/Selector.ts
129
+ var TYPE11 = "Selector";
130
+ var Selector = createSnapComponent(TYPE11);
131
+
132
+ // src/jsx/components/form/SelectorOption.ts
133
+ var TYPE12 = "SelectorOption";
134
+ var SelectorOption = createSnapComponent(TYPE12);
135
+
124
136
  // src/jsx/components/formatting/Bold.ts
125
- var TYPE11 = "Bold";
126
- var Bold = createSnapComponent(TYPE11);
137
+ var TYPE13 = "Bold";
138
+ var Bold = createSnapComponent(TYPE13);
127
139
 
128
140
  // src/jsx/components/formatting/Italic.ts
129
- var TYPE12 = "Italic";
130
- var Italic = createSnapComponent(TYPE12);
141
+ var TYPE14 = "Italic";
142
+ var Italic = createSnapComponent(TYPE14);
131
143
 
132
144
  // src/jsx/components/Address.ts
133
- var TYPE13 = "Address";
134
- var Address = createSnapComponent(TYPE13);
145
+ var TYPE15 = "Address";
146
+ var Address = createSnapComponent(TYPE15);
135
147
 
136
148
  // src/jsx/components/Box.ts
137
- var TYPE14 = "Box";
138
- var Box = createSnapComponent(TYPE14);
149
+ var TYPE16 = "Box";
150
+ var Box = createSnapComponent(TYPE16);
139
151
 
140
152
  // src/jsx/components/Card.ts
141
- var TYPE15 = "Card";
142
- var Card = createSnapComponent(TYPE15);
153
+ var TYPE17 = "Card";
154
+ var Card = createSnapComponent(TYPE17);
143
155
 
144
156
  // src/jsx/components/Copyable.ts
145
- var TYPE16 = "Copyable";
146
- var Copyable = createSnapComponent(TYPE16);
157
+ var TYPE18 = "Copyable";
158
+ var Copyable = createSnapComponent(TYPE18);
147
159
 
148
160
  // src/jsx/components/Divider.ts
149
- var TYPE17 = "Divider";
150
- var Divider = createSnapComponent(TYPE17);
161
+ var TYPE19 = "Divider";
162
+ var Divider = createSnapComponent(TYPE19);
151
163
 
152
164
  // src/jsx/components/Value.ts
153
- var TYPE18 = "Value";
154
- var Value = createSnapComponent(TYPE18);
165
+ var TYPE20 = "Value";
166
+ var Value = createSnapComponent(TYPE20);
155
167
 
156
168
  // src/jsx/components/Heading.ts
157
- var TYPE19 = "Heading";
158
- var Heading = createSnapComponent(TYPE19);
169
+ var TYPE21 = "Heading";
170
+ var Heading = createSnapComponent(TYPE21);
171
+
172
+ // src/jsx/components/Icon.ts
173
+ var IconName = /* @__PURE__ */ ((IconName2) => {
174
+ IconName2["AddSquare"] = "add-square";
175
+ IconName2["Add"] = "add";
176
+ IconName2["Arrow2Down"] = "arrow-2-down";
177
+ IconName2["Arrow2Left"] = "arrow-2-left";
178
+ IconName2["Arrow2Right"] = "arrow-2-right";
179
+ IconName2["Arrow2Up"] = "arrow-2-up";
180
+ IconName2["Arrow2UpRight"] = "arrow-2-up-right";
181
+ IconName2["ArrowDoubleLeft"] = "arrow-double-left";
182
+ IconName2["ArrowDoubleRight"] = "arrow-double-right";
183
+ IconName2["ArrowDown"] = "arrow-down";
184
+ IconName2["ArrowLeft"] = "arrow-left";
185
+ IconName2["ArrowRight"] = "arrow-right";
186
+ IconName2["ArrowUp"] = "arrow-up";
187
+ IconName2["BankToken"] = "bank-token";
188
+ IconName2["Bank"] = "bank";
189
+ IconName2["Book"] = "book";
190
+ IconName2["Bookmark"] = "bookmark";
191
+ IconName2["Bridge"] = "bridge";
192
+ IconName2["Calculator"] = "calculator";
193
+ IconName2["CardPos"] = "card-pos";
194
+ IconName2["CardToken"] = "card-token";
195
+ IconName2["Card"] = "card";
196
+ IconName2["Category"] = "category";
197
+ IconName2["Chart"] = "chart";
198
+ IconName2["CheckBold"] = "check-bold";
199
+ IconName2["Check"] = "check";
200
+ IconName2["Clock"] = "clock";
201
+ IconName2["Close"] = "close";
202
+ IconName2["CodeCircle"] = "code-circle";
203
+ IconName2["Coin"] = "coin";
204
+ IconName2["Confirmation"] = "confirmation";
205
+ IconName2["Connect"] = "connect";
206
+ IconName2["CopySuccess"] = "copy-success";
207
+ IconName2["Copy"] = "copy";
208
+ IconName2["Customize"] = "customize";
209
+ IconName2["Danger"] = "danger";
210
+ IconName2["Dark"] = "dark";
211
+ IconName2["Data"] = "data";
212
+ IconName2["Diagram"] = "diagram";
213
+ IconName2["DocumentCode"] = "document-code";
214
+ IconName2["DragDrop"] = "drag-drop";
215
+ IconName2["DraggingAnimation"] = "dragging-animation";
216
+ IconName2["PinningAnimation"] = "pinning-animation";
217
+ IconName2["Edit"] = "edit";
218
+ IconName2["Eraser"] = "eraser";
219
+ IconName2["Ethereum"] = "ethereum";
220
+ IconName2["Expand"] = "expand";
221
+ IconName2["Explore"] = "explore";
222
+ IconName2["Export"] = "export";
223
+ IconName2["EyeSlash"] = "eye-slash";
224
+ IconName2["Eye"] = "eye";
225
+ IconName2["Filter"] = "filter";
226
+ IconName2["Flag"] = "flag";
227
+ IconName2["FlashSlash"] = "flash-slash";
228
+ IconName2["Flash"] = "flash";
229
+ IconName2["FullCircle"] = "full-circle";
230
+ IconName2["Gas"] = "gas";
231
+ IconName2["GlobalSearch"] = "global-search";
232
+ IconName2["Global"] = "global";
233
+ IconName2["Graph"] = "graph";
234
+ IconName2["Hardware"] = "hardware";
235
+ IconName2["Heart"] = "heart";
236
+ IconName2["Hierarchy"] = "hierarchy";
237
+ IconName2["Home"] = "home";
238
+ IconName2["Import"] = "import";
239
+ IconName2["Info"] = "info";
240
+ IconName2["Key"] = "key";
241
+ IconName2["Light"] = "light";
242
+ IconName2["Link"] = "link";
243
+ IconName2["Loading"] = "loading";
244
+ IconName2["LockCircle"] = "lock-circle";
245
+ IconName2["LockSlash"] = "lock-slash";
246
+ IconName2["Lock"] = "lock";
247
+ IconName2["Login"] = "login";
248
+ IconName2["Logout"] = "logout";
249
+ IconName2["Menu"] = "menu";
250
+ IconName2["MessageQuestion"] = "message-question";
251
+ IconName2["Messages"] = "messages";
252
+ IconName2["MinusBold"] = "minus-bold";
253
+ IconName2["MinusSquare"] = "minus-square";
254
+ IconName2["Minus"] = "minus";
255
+ IconName2["Mobile"] = "mobile";
256
+ IconName2["Money"] = "money";
257
+ IconName2["Monitor"] = "monitor";
258
+ IconName2["MoreHorizontal"] = "more-horizontal";
259
+ IconName2["MoreVertical"] = "more-vertical";
260
+ IconName2["NotificationCircle"] = "notification-circle";
261
+ IconName2["Notification"] = "notification";
262
+ IconName2["PasswordCheck"] = "password-check";
263
+ IconName2["People"] = "people";
264
+ IconName2["Pin"] = "pin";
265
+ IconName2["ProgrammingArrows"] = "programming-arrows";
266
+ IconName2["Custody"] = "custody";
267
+ IconName2["Question"] = "question";
268
+ IconName2["Received"] = "received";
269
+ IconName2["Refresh"] = "refresh";
270
+ IconName2["Save"] = "save";
271
+ IconName2["ScanBarcode"] = "scan-barcode";
272
+ IconName2["ScanFocus"] = "scan-focus";
273
+ IconName2["Scan"] = "scan";
274
+ IconName2["Scroll"] = "scroll";
275
+ IconName2["Search"] = "search";
276
+ IconName2["SecurityCard"] = "security-card";
277
+ IconName2["SecurityCross"] = "security-cross";
278
+ IconName2["SecurityKey"] = "security-key";
279
+ IconName2["SecuritySearch"] = "security-search";
280
+ IconName2["SecuritySlash"] = "security-slash";
281
+ IconName2["SecurityTick"] = "security-tick";
282
+ IconName2["SecurityTime"] = "security-time";
283
+ IconName2["SecurityUser"] = "security-user";
284
+ IconName2["Security"] = "security";
285
+ IconName2["Send1"] = "send-1";
286
+ IconName2["Send2"] = "send-2";
287
+ IconName2["Setting"] = "setting";
288
+ IconName2["Slash"] = "slash";
289
+ IconName2["SnapsMobile"] = "snaps-mobile";
290
+ IconName2["SnapsPlus"] = "snaps-plus";
291
+ IconName2["Snaps"] = "snaps";
292
+ IconName2["Speedometer"] = "speedometer";
293
+ IconName2["Star"] = "star";
294
+ IconName2["Stake"] = "stake";
295
+ IconName2["Student"] = "student";
296
+ IconName2["SwapHorizontal"] = "swap-horizontal";
297
+ IconName2["SwapVertical"] = "swap-vertical";
298
+ IconName2["Tag"] = "tag";
299
+ IconName2["Tilde"] = "tilde";
300
+ IconName2["Timer"] = "timer";
301
+ IconName2["Trash"] = "trash";
302
+ IconName2["TrendDown"] = "trend-down";
303
+ IconName2["TrendUp"] = "trend-up";
304
+ IconName2["UserCircleAdd"] = "user-circle-add";
305
+ IconName2["UserCircleLink"] = "user-circle-link";
306
+ IconName2["UserCircleRemove"] = "user-circle-remove";
307
+ IconName2["UserCircle"] = "user-circle";
308
+ IconName2["User"] = "user";
309
+ IconName2["WalletCard"] = "wallet-card";
310
+ IconName2["WalletMoney"] = "wallet-money";
311
+ IconName2["Wallet"] = "wallet";
312
+ IconName2["Warning"] = "warning";
313
+ IconName2["Twitter"] = "twitter";
314
+ IconName2["QrCode"] = "qr-code";
315
+ IconName2["UserCheck"] = "user-check";
316
+ IconName2["Unpin"] = "unpin";
317
+ IconName2["Ban"] = "ban";
318
+ IconName2["Bold"] = "bold";
319
+ IconName2["CircleX"] = "circle-x";
320
+ IconName2["Download"] = "download";
321
+ IconName2["FileIcon"] = "file";
322
+ IconName2["Flask"] = "flask";
323
+ IconName2["Plug"] = "plug";
324
+ IconName2["Share"] = "share";
325
+ IconName2["Square"] = "square";
326
+ IconName2["Tint"] = "tint";
327
+ IconName2["Upload"] = "upload";
328
+ IconName2["Usb"] = "usb";
329
+ IconName2["Wifi"] = "wifi";
330
+ IconName2["PlusMinus"] = "plus-minus";
331
+ return IconName2;
332
+ })(IconName || {});
333
+ var TYPE22 = "Icon";
334
+ var Icon = createSnapComponent(TYPE22);
159
335
 
160
336
  // src/jsx/components/Image.ts
161
- var TYPE20 = "Image";
162
- var Image = createSnapComponent(TYPE20);
337
+ var TYPE23 = "Image";
338
+ var Image = createSnapComponent(TYPE23);
163
339
 
164
340
  // src/jsx/components/Link.ts
165
- var TYPE21 = "Link";
166
- var Link = createSnapComponent(TYPE21);
341
+ var TYPE24 = "Link";
342
+ var Link = createSnapComponent(TYPE24);
167
343
 
168
344
  // src/jsx/components/Row.ts
169
- var TYPE22 = "Row";
170
- var Row = createSnapComponent(TYPE22);
345
+ var TYPE25 = "Row";
346
+ var Row = createSnapComponent(TYPE25);
171
347
 
172
348
  // src/jsx/components/Spinner.ts
173
- var TYPE23 = "Spinner";
174
- var Spinner = createSnapComponent(TYPE23);
349
+ var TYPE26 = "Spinner";
350
+ var Spinner = createSnapComponent(TYPE26);
175
351
 
176
352
  // src/jsx/components/Text.ts
177
- var TYPE24 = "Text";
178
- var Text = createSnapComponent(TYPE24);
353
+ var TYPE27 = "Text";
354
+ var Text = createSnapComponent(TYPE27);
179
355
 
180
356
  // src/jsx/components/Tooltip.ts
181
- var TYPE25 = "Tooltip";
182
- var Tooltip = createSnapComponent(TYPE25);
357
+ var TYPE28 = "Tooltip";
358
+ var Tooltip = createSnapComponent(TYPE28);
183
359
 
184
360
  // src/jsx/components/Footer.ts
185
- var TYPE26 = "Footer";
186
- var Footer = createSnapComponent(TYPE26);
361
+ var TYPE29 = "Footer";
362
+ var Footer = createSnapComponent(TYPE29);
187
363
 
188
364
  // src/jsx/components/Container.ts
189
- var TYPE27 = "Container";
190
- var Container = createSnapComponent(TYPE27);
365
+ var TYPE30 = "Container";
366
+ var Container = createSnapComponent(TYPE30);
191
367
 
192
368
  // src/jsx/jsx-runtime.ts
193
369
  function jsx(component, props, key) {
@@ -235,7 +411,7 @@ function union([
235
411
  function typedUnion(structs) {
236
412
  return new import_superstruct.Struct({
237
413
  type: "union",
238
- schema: null,
414
+ schema: structs,
239
415
  *entries(value, context) {
240
416
  if (!(0, import_utils.isPlainObject)(value) || !(0, import_utils.hasProperty)(value, "type")) {
241
417
  return;
@@ -311,8 +487,22 @@ function element(name, props = {}) {
311
487
  key: (0, import_superstruct3.nullable)(KeyStruct)
312
488
  });
313
489
  }
490
+ var ImageStruct = element("Image", {
491
+ src: svg(),
492
+ alt: (0, import_superstruct3.optional)((0, import_superstruct3.string)())
493
+ });
494
+ var IconNameStruct = nullUnion(
495
+ Object.values(IconName).map((name) => literal(name))
496
+ );
497
+ var IconStruct = element("Icon", {
498
+ name: IconNameStruct,
499
+ color: (0, import_superstruct3.optional)(
500
+ nullUnion([literal("default"), literal("primary"), literal("muted")])
501
+ ),
502
+ size: (0, import_superstruct3.optional)(nullUnion([literal("md"), literal("inherit")]))
503
+ });
314
504
  var ButtonStruct = element("Button", {
315
- children: StringElementStruct,
505
+ children: children([StringElementStruct, ImageStruct, IconStruct]),
316
506
  name: (0, import_superstruct3.optional)((0, import_superstruct3.string)()),
317
507
  type: (0, import_superstruct3.optional)(nullUnion([literal("button"), literal("submit")])),
318
508
  variant: (0, import_superstruct3.optional)(nullUnion([literal("primary"), literal("destructive")])),
@@ -334,13 +524,33 @@ var InputStruct = element("Input", {
334
524
  });
335
525
  var OptionStruct = element("Option", {
336
526
  value: (0, import_superstruct3.string)(),
337
- children: (0, import_superstruct3.string)()
527
+ children: nullUnion([(0, import_superstruct3.string)()])
338
528
  });
339
529
  var DropdownStruct = element("Dropdown", {
340
530
  name: (0, import_superstruct3.string)(),
341
531
  value: (0, import_superstruct3.optional)((0, import_superstruct3.string)()),
342
532
  children: children([OptionStruct])
343
533
  });
534
+ var CardStruct = element("Card", {
535
+ image: (0, import_superstruct3.optional)((0, import_superstruct3.string)()),
536
+ title: (0, import_superstruct3.string)(),
537
+ description: (0, import_superstruct3.optional)((0, import_superstruct3.string)()),
538
+ value: (0, import_superstruct3.string)(),
539
+ extra: (0, import_superstruct3.optional)((0, import_superstruct3.string)())
540
+ });
541
+ var SelectorOptionStruct = element(
542
+ "SelectorOption",
543
+ {
544
+ value: (0, import_superstruct3.string)(),
545
+ children: CardStruct
546
+ }
547
+ );
548
+ var SelectorStruct = element("Selector", {
549
+ name: (0, import_superstruct3.string)(),
550
+ title: (0, import_superstruct3.string)(),
551
+ value: (0, import_superstruct3.optional)((0, import_superstruct3.string)()),
552
+ children: children([SelectorOptionStruct])
553
+ });
344
554
  var RadioStruct = element("Radio", {
345
555
  value: (0, import_superstruct3.string)(),
346
556
  children: (0, import_superstruct3.string)()
@@ -367,7 +577,8 @@ var FIELD_CHILDREN_ARRAY = [
367
577
  DropdownStruct,
368
578
  RadioGroupStruct,
369
579
  FileInputStruct,
370
- CheckboxStruct
580
+ CheckboxStruct,
581
+ SelectorStruct
371
582
  ];
372
583
  var FieldChildUnionStruct = nullUnion([
373
584
  ...FIELD_CHILDREN_ARRAY,
@@ -454,28 +665,33 @@ var ValueStruct = element("Value", {
454
665
  value: (0, import_superstruct3.string)(),
455
666
  extra: (0, import_superstruct3.string)()
456
667
  });
457
- var CardStruct = element("Card", {
458
- image: (0, import_superstruct3.optional)((0, import_superstruct3.string)()),
459
- title: (0, import_superstruct3.string)(),
460
- description: (0, import_superstruct3.optional)((0, import_superstruct3.string)()),
461
- value: (0, import_superstruct3.string)(),
462
- extra: (0, import_superstruct3.optional)((0, import_superstruct3.string)())
463
- });
464
668
  var HeadingStruct = element("Heading", {
465
669
  children: StringElementStruct
466
670
  });
467
- var ImageStruct = element("Image", {
468
- src: svg(),
469
- alt: (0, import_superstruct3.optional)((0, import_superstruct3.string)())
470
- });
471
671
  var LinkStruct = element("Link", {
472
672
  href: (0, import_superstruct3.string)(),
473
673
  children: children([FormattingStruct, (0, import_superstruct3.string)()])
474
674
  });
475
675
  var TextStruct = element("Text", {
476
- children: children([(0, import_superstruct3.string)(), BoldStruct, ItalicStruct, LinkStruct]),
676
+ children: children([
677
+ (0, import_superstruct3.string)(),
678
+ BoldStruct,
679
+ ItalicStruct,
680
+ LinkStruct,
681
+ IconStruct
682
+ ]),
477
683
  alignment: (0, import_superstruct3.optional)(
478
684
  nullUnion([literal("start"), literal("center"), literal("end")])
685
+ ),
686
+ color: (0, import_superstruct3.optional)(
687
+ nullUnion([
688
+ literal("default"),
689
+ literal("alternative"),
690
+ literal("muted"),
691
+ literal("error"),
692
+ literal("success"),
693
+ literal("warning")
694
+ ])
479
695
  )
480
696
  });
481
697
  var TooltipChildStruct = nullUnion([
@@ -484,6 +700,7 @@ var TooltipChildStruct = nullUnion([
484
700
  ItalicStruct,
485
701
  LinkStruct,
486
702
  ImageStruct,
703
+ IconStruct,
487
704
  (0, import_superstruct3.boolean)()
488
705
  ]);
489
706
  var TooltipContentStruct = nullUnion([
@@ -491,6 +708,7 @@ var TooltipContentStruct = nullUnion([
491
708
  BoldStruct,
492
709
  ItalicStruct,
493
710
  LinkStruct,
711
+ IconStruct,
494
712
  (0, import_superstruct3.string)()
495
713
  ]);
496
714
  var TooltipStruct = element("Tooltip", {
@@ -527,7 +745,9 @@ var BoxChildStruct = typedUnion([
527
745
  TextStruct,
528
746
  TooltipStruct,
529
747
  CheckboxStruct,
530
- CardStruct
748
+ CardStruct,
749
+ IconStruct,
750
+ SelectorStruct
531
751
  ]);
532
752
  var RootJSXElementStruct = nullUnion([
533
753
  BoxChildStruct,
@@ -560,7 +780,10 @@ var JSXElementStruct = typedUnion([
560
780
  CheckboxStruct,
561
781
  FooterStruct,
562
782
  ContainerStruct,
563
- CardStruct
783
+ CardStruct,
784
+ IconStruct,
785
+ SelectorStruct,
786
+ SelectorOptionStruct
564
787
  ]);
565
788
  function isJSXElement(value) {
566
789
  return (0, import_superstruct3.is)(value, JSXElementStruct);