@metamask/snaps-sdk 6.13.0 → 6.14.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.
Files changed (70) hide show
  1. package/CHANGELOG.md +16 -1
  2. package/dist/error-wrappers.d.cts +192 -192
  3. package/dist/error-wrappers.d.mts +192 -192
  4. package/dist/internals/error-wrappers.d.cts +12 -12
  5. package/dist/internals/error-wrappers.d.mts +12 -12
  6. package/dist/jsx/components/Banner.cjs +19 -0
  7. package/dist/jsx/components/Banner.cjs.map +1 -0
  8. package/dist/jsx/components/Banner.d.cts +42 -0
  9. package/dist/jsx/components/Banner.d.cts.map +1 -0
  10. package/dist/jsx/components/Banner.d.mts +42 -0
  11. package/dist/jsx/components/Banner.d.mts.map +1 -0
  12. package/dist/jsx/components/Banner.mjs +16 -0
  13. package/dist/jsx/components/Banner.mjs.map +1 -0
  14. package/dist/jsx/components/Text.cjs +5 -0
  15. package/dist/jsx/components/Text.cjs.map +1 -1
  16. package/dist/jsx/components/Text.d.cts +7 -0
  17. package/dist/jsx/components/Text.d.cts.map +1 -1
  18. package/dist/jsx/components/Text.d.mts +7 -0
  19. package/dist/jsx/components/Text.d.mts.map +1 -1
  20. package/dist/jsx/components/Text.mjs +5 -0
  21. package/dist/jsx/components/Text.mjs.map +1 -1
  22. package/dist/jsx/components/form/Button.cjs.map +1 -1
  23. package/dist/jsx/components/form/Button.d.cts +4 -0
  24. package/dist/jsx/components/form/Button.d.cts.map +1 -1
  25. package/dist/jsx/components/form/Button.d.mts +4 -0
  26. package/dist/jsx/components/form/Button.d.mts.map +1 -1
  27. package/dist/jsx/components/form/Button.mjs.map +1 -1
  28. package/dist/jsx/components/index.cjs +1 -0
  29. package/dist/jsx/components/index.cjs.map +1 -1
  30. package/dist/jsx/components/index.d.cts +3 -1
  31. package/dist/jsx/components/index.d.cts.map +1 -1
  32. package/dist/jsx/components/index.d.mts +3 -1
  33. package/dist/jsx/components/index.d.mts.map +1 -1
  34. package/dist/jsx/components/index.mjs +1 -0
  35. package/dist/jsx/components/index.mjs.map +1 -1
  36. package/dist/jsx/validation.cjs +39 -8
  37. package/dist/jsx/validation.cjs.map +1 -1
  38. package/dist/jsx/validation.d.cts +8 -4
  39. package/dist/jsx/validation.d.cts.map +1 -1
  40. package/dist/jsx/validation.d.mts +8 -4
  41. package/dist/jsx/validation.d.mts.map +1 -1
  42. package/dist/jsx/validation.mjs +38 -7
  43. package/dist/jsx/validation.mjs.map +1 -1
  44. package/dist/types/handlers/index.cjs +1 -0
  45. package/dist/types/handlers/index.cjs.map +1 -1
  46. package/dist/types/handlers/index.d.cts +1 -0
  47. package/dist/types/handlers/index.d.cts.map +1 -1
  48. package/dist/types/handlers/index.d.mts +1 -0
  49. package/dist/types/handlers/index.d.mts.map +1 -1
  50. package/dist/types/handlers/index.mjs +1 -0
  51. package/dist/types/handlers/index.mjs.map +1 -1
  52. package/dist/types/handlers/settings-page.cjs +3 -0
  53. package/dist/types/handlers/settings-page.cjs.map +1 -0
  54. package/dist/types/handlers/settings-page.d.cts +23 -0
  55. package/dist/types/handlers/settings-page.d.cts.map +1 -0
  56. package/dist/types/handlers/settings-page.d.mts +23 -0
  57. package/dist/types/handlers/settings-page.d.mts.map +1 -0
  58. package/dist/types/handlers/settings-page.mjs +2 -0
  59. package/dist/types/handlers/settings-page.mjs.map +1 -0
  60. package/dist/types/interface.d.cts +1 -1
  61. package/dist/types/interface.d.cts.map +1 -1
  62. package/dist/types/interface.d.mts +1 -1
  63. package/dist/types/interface.d.mts.map +1 -1
  64. package/dist/types/permissions.cjs.map +1 -1
  65. package/dist/types/permissions.d.cts +3 -0
  66. package/dist/types/permissions.d.cts.map +1 -1
  67. package/dist/types/permissions.d.mts +3 -0
  68. package/dist/types/permissions.d.mts.map +1 -1
  69. package/dist/types/permissions.mjs.map +1 -1
  70. package/package.json +1 -1
@@ -1,7 +1,7 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.isJSXElement = exports.JSXElementStruct = exports.RootJSXElementStruct = exports.ContainerStruct = exports.BoxChildStruct = exports.SpinnerStruct = exports.RowStruct = exports.TooltipStruct = exports.TooltipContentStruct = exports.TooltipChildStruct = exports.TextStruct = exports.LinkStruct = exports.HeadingStruct = exports.ValueStruct = exports.DividerStruct = exports.CopyableStruct = exports.FooterStruct = exports.FooterChildStruct = exports.SectionStruct = exports.FormStruct = exports.FormChildStruct = exports.BoxStruct = exports.BoxChildrenStruct = exports.AvatarStruct = exports.FormattingStruct = exports.ItalicStruct = exports.BoldStruct = exports.FieldStruct = exports.FieldChildUnionStruct = exports.FileInputStruct = exports.RadioGroupStruct = exports.RadioStruct = exports.SelectorStruct = exports.SelectorOptionStruct = exports.CardStruct = exports.AddressStruct = exports.DropdownStruct = exports.OptionStruct = exports.InputStruct = exports.NumberInputPropsStruct = exports.PasswordInputPropsStruct = exports.TextInputPropsStruct = exports.GenericInputPropsStruct = exports.CheckboxStruct = exports.ButtonStruct = exports.IconStruct = exports.ImageStruct = exports.ElementStruct = exports.StringElementStruct = exports.KeyStruct = void 0;
4
- exports.assertJSXElement = exports.isJSXElementUnsafe = void 0;
3
+ exports.JSXElementStruct = exports.RootJSXElementStruct = exports.ContainerStruct = exports.BoxChildStruct = exports.SpinnerStruct = exports.RowStruct = exports.BannerStruct = exports.TooltipStruct = exports.TooltipContentStruct = exports.TooltipChildStruct = exports.TextStruct = exports.LinkStruct = exports.HeadingStruct = exports.ValueStruct = exports.DividerStruct = exports.CopyableStruct = exports.FooterStruct = exports.FooterChildStruct = exports.SectionStruct = exports.FormStruct = exports.FormChildStruct = exports.BoxStruct = exports.BoxChildrenStruct = exports.AvatarStruct = exports.FormattingStruct = exports.ItalicStruct = exports.BoldStruct = exports.FieldStruct = exports.FieldChildUnionStruct = exports.FileInputStruct = exports.RadioGroupStruct = exports.RadioStruct = exports.SelectorStruct = exports.SelectorOptionStruct = exports.CardStruct = exports.AddressStruct = exports.DropdownStruct = exports.OptionStruct = exports.InputStruct = exports.NumberInputPropsStruct = exports.PasswordInputPropsStruct = exports.TextInputPropsStruct = exports.GenericInputPropsStruct = exports.CheckboxStruct = exports.ButtonStruct = exports.IconStruct = exports.ImageStruct = exports.ElementStruct = exports.StringElementStruct = exports.KeyStruct = void 0;
4
+ exports.assertJSXElement = exports.isJSXElementUnsafe = exports.isJSXElement = void 0;
5
5
  const superstruct_1 = require("@metamask/superstruct");
6
6
  const utils_1 = require("@metamask/utils");
7
7
  const internals_1 = require("../internals/index.cjs");
@@ -124,7 +124,9 @@ exports.ButtonStruct = element('Button', {
124
124
  name: (0, superstruct_1.optional)((0, superstruct_1.string)()),
125
125
  type: (0, superstruct_1.optional)((0, internals_1.nullUnion)([(0, internals_1.literal)('button'), (0, internals_1.literal)('submit')])),
126
126
  variant: (0, superstruct_1.optional)((0, internals_1.nullUnion)([(0, internals_1.literal)('primary'), (0, internals_1.literal)('destructive')])),
127
+ size: (0, superstruct_1.optional)((0, internals_1.nullUnion)([(0, internals_1.literal)('sm'), (0, internals_1.literal)('md')])),
127
128
  disabled: (0, superstruct_1.optional)((0, superstruct_1.boolean)()),
129
+ loading: (0, superstruct_1.optional)((0, superstruct_1.boolean)()),
128
130
  form: (0, superstruct_1.optional)((0, superstruct_1.string)()),
129
131
  });
130
132
  /**
@@ -311,12 +313,18 @@ exports.FieldChildUnionStruct = (0, internals_1.nullUnion)([
311
313
  /**
312
314
  * A subset of JSX elements that are allowed as children of the Field component.
313
315
  */
314
- const FieldChildStruct = (0, internals_1.nullUnion)([
315
- (0, superstruct_1.tuple)(BOX_INPUT_LEFT),
316
- (0, superstruct_1.tuple)(BOX_INPUT_RIGHT),
317
- (0, superstruct_1.tuple)(BOX_INPUT_BOTH),
318
- ...FIELD_CHILDREN_ARRAY,
319
- ]);
316
+ const FieldChildStruct = (0, internals_1.selectiveUnion)((value) => {
317
+ const isArray = Array.isArray(value);
318
+ if (isArray && value.length === 3) {
319
+ return (0, superstruct_1.tuple)(BOX_INPUT_BOTH);
320
+ }
321
+ if (isArray && value.length === 2) {
322
+ return value[0]?.type === 'Box'
323
+ ? (0, superstruct_1.tuple)(BOX_INPUT_LEFT)
324
+ : (0, superstruct_1.tuple)(BOX_INPUT_RIGHT);
325
+ }
326
+ return (0, internals_1.typedUnion)(FIELD_CHILDREN_ARRAY);
327
+ });
320
328
  /**
321
329
  * A struct for the {@link FieldElement} type.
322
330
  */
@@ -488,6 +496,7 @@ exports.TextStruct = element('Text', {
488
496
  (0, internals_1.literal)('warning'),
489
497
  ])),
490
498
  size: (0, superstruct_1.optional)((0, internals_1.nullUnion)([(0, internals_1.literal)('sm'), (0, internals_1.literal)('md')])),
499
+ fontWeight: (0, superstruct_1.optional)((0, internals_1.nullUnion)([(0, internals_1.literal)('regular'), (0, internals_1.literal)('medium'), (0, internals_1.literal)('bold')])),
491
500
  });
492
501
  /**
493
502
  * A subset of JSX elements that are allowed as children of the Tooltip component.
@@ -529,6 +538,26 @@ exports.TooltipStruct = element('Tooltip', {
529
538
  children: (0, superstruct_1.nullable)(exports.TooltipChildStruct),
530
539
  content: exports.TooltipContentStruct,
531
540
  });
541
+ /**
542
+ * A struct for the {@link BannerElement} type.
543
+ */
544
+ exports.BannerStruct = element('Banner', {
545
+ children: children([
546
+ exports.TextStruct,
547
+ exports.LinkStruct,
548
+ exports.IconStruct,
549
+ exports.ButtonStruct,
550
+ exports.BoldStruct,
551
+ exports.ItalicStruct,
552
+ ]),
553
+ title: (0, superstruct_1.string)(),
554
+ severity: (0, superstruct_1.union)([
555
+ (0, internals_1.literal)('danger'),
556
+ (0, internals_1.literal)('info'),
557
+ (0, internals_1.literal)('success'),
558
+ (0, internals_1.literal)('warning'),
559
+ ]),
560
+ });
532
561
  /**
533
562
  * A struct for the {@link RowElement} type.
534
563
  */
@@ -580,6 +609,7 @@ exports.BoxChildStruct = (0, internals_1.typedUnion)([
580
609
  exports.SelectorStruct,
581
610
  exports.SectionStruct,
582
611
  exports.AvatarStruct,
612
+ exports.BannerStruct,
583
613
  ]);
584
614
  /**
585
615
  * A struct for the {@link ContainerElement} type.
@@ -636,6 +666,7 @@ exports.JSXElementStruct = (0, internals_1.typedUnion)([
636
666
  exports.SelectorOptionStruct,
637
667
  exports.SectionStruct,
638
668
  exports.AvatarStruct,
669
+ exports.BannerStruct,
639
670
  ]);
640
671
  /**
641
672
  * Check if a value is a JSX element.
@@ -1 +1 @@
1
- {"version":3,"file":"validation.cjs","sourceRoot":"","sources":["../../src/jsx/validation.ts"],"names":[],"mappings":";;;;AAOA,uDAc+B;AAC/B,2CAMyB;AAGzB,sDAMsB;AAatB,uDAmCsB;AAEtB;;GAEG;AACU,QAAA,SAAS,GAAkB,IAAA,qBAAS,EAAC,CAAC,IAAA,oBAAM,GAAE,EAAE,IAAA,oBAAM,GAAE,CAAC,CAAC,CAAC;AAExE;;GAEG;AACU,QAAA,mBAAmB,GAA4B,QAAQ,CAAC;IACnE,IAAA,oBAAM,GAAE;CACT,CAAC,CAAC;AAEH;;GAEG;AACU,QAAA,aAAa,GAAiC,IAAA,oBAAM,EAAC;IAChE,IAAI,EAAE,IAAA,oBAAM,GAAE;IACd,KAAK,EAAE,IAAA,oBAAM,EAAC,IAAA,oBAAM,GAAE,EAAE,kBAAU,CAAC;IACnC,GAAG,EAAE,IAAA,sBAAQ,EAAC,iBAAS,CAAC;CACzB,CAAC,CAAC;AAEH;;;;;GAKG;AACH,SAAS,QAAQ,CACf,MAA4B;IAE5B,MAAM,cAAc,GAA2B,IAAA,0BAAc,EAAC,CAAC,KAAK,EAAE,EAAE;QACtE,IAAI,KAAK,CAAC,OAAO,CAAC,KAAK,CAAC,EAAE,CAAC;YACzB,OAAO,IAAA,mBAAK,EAAC,IAAA,kBAAI,EAAC,GAAG,EAAE,CAAC,cAAc,CAAC,CAAC,CAAC;QAC3C,CAAC;QACD,OAAO,MAAM,CAAC;IAChB,CAAC,CAAC,CAAC;IAEH,OAAO,cAAc,CAAC;AACxB,CAAC;AAED;;;;;;GAMG;AACH,SAAS,QA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ACd,oBAAY;IACZ,uBAAe;IACf,kBAAU;IACV,kBAAU;IACV,sBAAc;IACd,4BAAoB;IACpB,qBAAa;IACb,oBAAY;CACb,CAAC,CAAC;AAEH;;;;;GAKG;AACH,SAAgB,YAAY,CAAC,KAAc;IACzC,OAAO,IAAA,gBAAE,EAAC,KAAK,EAAE,wBAAgB,CAAC,CAAC;AACrC,CAAC;AAFD,oCAEC;AAED;;;;;;;;;;GAUG;AACH,SAAgB,kBAAkB,CAAC,KAAc;IAC/C,OAAO,CACL,IAAA,qBAAa,EAAC,KAAK,CAAC;QACpB,IAAA,mBAAW,EAAC,KAAK,EAAE,MAAM,CAAC;QAC1B,IAAA,mBAAW,EAAC,KAAK,EAAE,OAAO,CAAC;QAC3B,IAAA,mBAAW,EAAC,KAAK,EAAE,KAAK,CAAC,CAC1B,CAAC;AACJ,CAAC;AAPD,gDAOC;AAED;;;;;GAKG;AACH,SAAgB,gBAAgB,CAAC,KAAc;IAC7C,4EAA4E;IAC5E,0EAA0E;IAC1E,2DAA2D;IAC3D,IAAI,CAAC,YAAY,CAAC,KAAK,CAAC,EAAE,CAAC;QACzB,MAAM,IAAI,KAAK,CACb,wCAAwC,IAAI,CAAC,SAAS,CACpD,KAAK,CACN,qFAAqF,CACvF,CAAC;IACJ,CAAC;AACH,CAAC;AAXD,4CAWC","sourcesContent":["import type {\n AnyStruct,\n Infer,\n InferStructTuple,\n ObjectSchema,\n Struct,\n} from '@metamask/superstruct';\nimport {\n is,\n boolean,\n optional,\n array,\n lazy,\n nullable,\n number,\n object,\n record,\n string,\n tuple,\n refine,\n assign,\n} from '@metamask/superstruct';\nimport {\n CaipAccountIdStruct,\n hasProperty,\n HexChecksumAddressStruct,\n isPlainObject,\n JsonStruct,\n} from '@metamask/utils';\n\nimport type { Describe } from '../internals';\nimport {\n literal,\n nullUnion,\n selectiveUnion,\n svg,\n typedUnion,\n} from '../internals';\nimport type { EmptyObject } from '../types';\nimport type {\n GenericSnapChildren,\n GenericSnapElement,\n JsonObject,\n Key,\n Nestable,\n SnapElement,\n SnapsChildren,\n StringElement,\n} from './component';\nimport type { AvatarElement } from './components';\nimport {\n type AddressElement,\n type BoldElement,\n type BoxElement,\n type ButtonElement,\n type CheckboxElement,\n type CardElement,\n type CopyableElement,\n type DividerElement,\n type DropdownElement,\n type OptionElement,\n type RadioElement,\n type RadioGroupElement,\n type FieldElement,\n type FormElement,\n type HeadingElement,\n type ImageElement,\n type InputElement,\n type ItalicElement,\n type JSXElement,\n type LinkElement,\n type RowElement,\n type SpinnerElement,\n type StandardFormattingElement,\n type TextElement,\n type TooltipElement,\n type ValueElement,\n type FileInputElement,\n type ContainerElement,\n type FooterElement,\n type IconElement,\n type SectionElement,\n type SelectorElement,\n type SelectorOptionElement,\n IconName,\n} from './components';\n\n/**\n * A struct for the {@link Key} type.\n */\nexport const KeyStruct: Describe<Key> = nullUnion([string(), number()]);\n\n/**\n * A struct for the {@link StringElement} type.\n */\nexport const StringElementStruct: Describe<StringElement> = children([\n string(),\n]);\n\n/**\n * A struct for the {@link GenericSnapElement} type.\n */\nexport const ElementStruct: Describe<GenericSnapElement> = object({\n type: string(),\n props: record(string(), JsonStruct),\n key: nullable(KeyStruct),\n});\n\n/**\n * A helper function for creating a struct for a {@link Nestable} type.\n *\n * @param struct - The struct for the type to test.\n * @returns The struct for the nestable type.\n */\nfunction nestable<Type, Schema>(\n struct: Struct<Type, Schema>,\n): Struct<Nestable<Type>, any> {\n const nestableStruct: Struct<Nestable<Type>> = selectiveUnion((value) => {\n if (Array.isArray(value)) {\n return array(lazy(() => nestableStruct));\n }\n return struct;\n });\n\n return nestableStruct;\n}\n\n/**\n * A helper function for creating a struct which allows children of a specific\n * type, as well as `null` and `boolean`.\n *\n * @param structs - The structs to allow as children.\n * @returns The struct for the children.\n */\nfunction children<Head extends AnyStruct, Tail extends AnyStruct[]>(\n structs: [head: Head, ...tail: Tail],\n): Struct<\n Nestable<Infer<Head> | InferStructTuple<Tail>[number] | boolean | null>,\n null\n> {\n return nestable(\n nullable(\n selectiveUnion((value) => {\n if (typeof value === 'boolean') {\n return boolean();\n }\n if (structs.length === 1) {\n return structs[0];\n }\n return nullUnion(structs);\n }),\n ),\n ) as unknown as Struct<\n Nestable<Infer<Head> | InferStructTuple<Tail>[number] | boolean | null>,\n null\n >;\n}\n\n/**\n * A helper function for creating a struct which allows a single child of a specific\n * type, as well as `null` and `boolean`.\n *\n * @param struct - The struct to allow as a single child.\n * @returns The struct for the children.\n */\nfunction singleChild<Type extends AnyStruct>(\n struct: Type,\n): Struct<Infer<Type> | boolean | null, null> {\n return nullable(\n selectiveUnion((value) => {\n if (typeof value === 'boolean') {\n return boolean();\n }\n\n return struct;\n }),\n ) as unknown as Struct<Infer<Type> | boolean | null, null>;\n}\n\n/**\n * A helper function for creating a struct for a JSX element.\n *\n * @param name - The name of the element.\n * @param props - The props of the element.\n * @returns The struct for the element.\n */\nfunction element<Name extends string, Props extends ObjectSchema = EmptyObject>(\n name: Name,\n props: Props = {} as Props,\n) {\n return object({\n type: literal(name) as unknown as Struct<Name, Name>,\n props: object(props),\n key: nullable(KeyStruct),\n });\n}\n\n/**\n * A helper function for creating a struct for a JSX element with selective props.\n *\n * @param name - The name of the element.\n * @param selector - The selector function choosing the struct to validate with.\n * @returns The struct for the element.\n */\nfunction elementWithSelectiveProps<\n Name extends string,\n Selector extends (value: any) => AnyStruct,\n>(name: Name, selector: Selector) {\n return object({\n type: literal(name) as unknown as Struct<Name, Name>,\n props: selectiveUnion(selector),\n key: nullable(KeyStruct),\n });\n}\n\n/**\n * A struct for the {@link ImageElement} type.\n */\nexport const ImageStruct: Describe<ImageElement> = element('Image', {\n src: svg(),\n alt: optional(string()),\n});\n\nconst IconNameStruct: Struct<`${IconName}`, null> = nullUnion(\n Object.values(IconName).map((name) => literal(name)) as any,\n);\n\n/**\n * A struct for the {@link IconElement} type.\n */\nexport const IconStruct: Describe<IconElement> = element('Icon', {\n name: IconNameStruct,\n color: optional(\n nullUnion([literal('default'), literal('primary'), literal('muted')]),\n ),\n size: optional(nullUnion([literal('md'), literal('inherit')])),\n});\n\n/**\n * A struct for the {@link ButtonElement} type.\n */\nexport const ButtonStruct: Describe<ButtonElement> = element('Button', {\n children: children([StringElementStruct, ImageStruct, IconStruct]),\n name: optional(string()),\n type: optional(nullUnion([literal('button'), literal('submit')])),\n variant: optional(nullUnion([literal('primary'), literal('destructive')])),\n disabled: optional(boolean()),\n form: optional(string()),\n});\n\n/**\n * A struct for the {@link CheckboxElement} type.\n */\nexport const CheckboxStruct: Describe<CheckboxElement> = element('Checkbox', {\n name: string(),\n checked: optional(boolean()),\n label: optional(string()),\n variant: optional(nullUnion([literal('default'), literal('toggle')])),\n});\n\n/**\n * A struct for the generic input element props.\n */\nexport const GenericInputPropsStruct = object({\n name: string(),\n value: optional(string()),\n placeholder: optional(string()),\n});\n\n/**\n * A struct for the text type input props.\n */\nexport const TextInputPropsStruct = assign(\n GenericInputPropsStruct,\n object({\n type: literal('text'),\n }),\n);\n\n/**\n * A struct for the password type input props.\n */\nexport const PasswordInputPropsStruct = assign(\n GenericInputPropsStruct,\n object({\n type: literal('password'),\n }),\n);\n\n/**\n * A struct for the number type input props.\n */\nexport const NumberInputPropsStruct = assign(\n GenericInputPropsStruct,\n object({\n type: literal('number'),\n min: optional(number()),\n max: optional(number()),\n step: optional(number()),\n }),\n);\n\n/**\n * A struct for the {@link InputElement} type.\n */\nexport const InputStruct: Describe<InputElement> = elementWithSelectiveProps(\n 'Input',\n (value) => {\n if (isPlainObject(value) && hasProperty(value, 'type')) {\n switch (value.type) {\n case 'text':\n return TextInputPropsStruct;\n case 'password':\n return PasswordInputPropsStruct;\n case 'number':\n return NumberInputPropsStruct;\n default:\n return GenericInputPropsStruct;\n }\n }\n return GenericInputPropsStruct;\n },\n);\n\n/**\n * A struct for the {@link OptionElement} type.\n */\nexport const OptionStruct: Describe<OptionElement> = element('Option', {\n value: string(),\n children: string(),\n});\n\n/**\n * A struct for the {@link DropdownElement} type.\n */\nexport const DropdownStruct: Describe<DropdownElement> = element('Dropdown', {\n name: string(),\n value: optional(string()),\n children: children([OptionStruct]),\n});\n\n/**\n * A struct for the {@link AddressElement} type.\n */\nexport const AddressStruct: Describe<AddressElement> = element('Address', {\n address: nullUnion([HexChecksumAddressStruct, CaipAccountIdStruct]),\n truncate: optional(boolean()),\n displayName: optional(boolean()),\n avatar: optional(boolean()),\n});\n\n/**\n * A struct for the {@link CardElement} type.\n */\nexport const CardStruct: Describe<CardElement> = element('Card', {\n image: optional(string()),\n title: selectiveUnion((value) => {\n if (typeof value === 'object') {\n return AddressStruct;\n }\n return string();\n }),\n description: optional(string()),\n value: string(),\n extra: optional(string()),\n});\n\n/**\n * A struct for the {@link SelectorOptionElement} type.\n */\nexport const SelectorOptionStruct: Describe<SelectorOptionElement> = element(\n 'SelectorOption',\n {\n value: string(),\n children: CardStruct,\n },\n);\n\n/**\n * A struct for the {@link SelectorElement} type.\n */\nexport const SelectorStruct: Describe<SelectorElement> = element('Selector', {\n name: string(),\n title: string(),\n value: optional(string()),\n children: children([SelectorOptionStruct]),\n});\n\n/**\n * A struct for the {@link RadioElement} type.\n */\nexport const RadioStruct: Describe<RadioElement> = element('Radio', {\n value: string(),\n children: string(),\n});\n\n/**\n * A struct for the {@link RadioGroupElement} type.\n */\nexport const RadioGroupStruct: Describe<RadioGroupElement> = element(\n 'RadioGroup',\n {\n name: string(),\n value: optional(string()),\n children: children([RadioStruct]),\n },\n);\n\n/**\n * A struct for the {@link FileInputElement} type.\n */\nexport const FileInputStruct: Describe<FileInputElement> = element(\n 'FileInput',\n {\n name: string(),\n accept: nullUnion([optional(array(string()))]),\n compact: optional(boolean()),\n },\n);\n\n/**\n * A subset of JSX elements that represent the tuple Box + Input of the Field children.\n */\nconst BOX_INPUT_LEFT = [\n // eslint-disable-next-line @typescript-eslint/no-use-before-define\n singleChild(lazy(() => BoxChildStruct)),\n InputStruct,\n] as [typeof BoxChildStruct, typeof InputStruct];\n\n/**\n * A subset of JSX elements that represent the tuple Input + Box of the Field children.\n */\nconst BOX_INPUT_RIGHT = [\n InputStruct,\n // eslint-disable-next-line @typescript-eslint/no-use-before-define\n singleChild(lazy(() => BoxChildStruct)),\n] as [typeof InputStruct, typeof BoxChildStruct];\n\n/**\n * A subset of JSX elements that represent the tuple Box + Input + Box of the Field children.\n */\nconst BOX_INPUT_BOTH = [\n // eslint-disable-next-line @typescript-eslint/no-use-before-define\n singleChild(lazy(() => BoxChildStruct)),\n InputStruct,\n // eslint-disable-next-line @typescript-eslint/no-use-before-define\n singleChild(lazy(() => BoxChildStruct)),\n] as [typeof BoxChildStruct, typeof InputStruct, typeof BoxChildStruct];\n\n/**\n * A subset of JSX elements that are allowed as single children of the Field component.\n */\nconst FIELD_CHILDREN_ARRAY = [\n InputStruct,\n DropdownStruct,\n RadioGroupStruct,\n FileInputStruct,\n CheckboxStruct,\n SelectorStruct,\n] as [\n typeof InputStruct,\n typeof DropdownStruct,\n typeof RadioGroupStruct,\n typeof FileInputStruct,\n typeof CheckboxStruct,\n typeof SelectorStruct,\n];\n\n/**\n * A union of the allowed children of the Field component.\n * This is mainly used in the simulator for validation purposes.\n */\nexport const FieldChildUnionStruct = nullUnion([\n ...FIELD_CHILDREN_ARRAY,\n ...BOX_INPUT_LEFT,\n ...BOX_INPUT_RIGHT,\n ...BOX_INPUT_BOTH,\n]);\n\n/**\n * A subset of JSX elements that are allowed as children of the Field component.\n */\nconst FieldChildStruct = nullUnion([\n tuple(BOX_INPUT_LEFT),\n tuple(BOX_INPUT_RIGHT),\n tuple(BOX_INPUT_BOTH),\n ...FIELD_CHILDREN_ARRAY,\n]) as unknown as Struct<\n | [InputElement, GenericSnapChildren]\n | [GenericSnapChildren, InputElement]\n | [GenericSnapChildren, InputElement, GenericSnapChildren]\n | DropdownElement\n | RadioGroupElement\n | FileInputElement\n | InputElement\n | CheckboxElement\n | SelectorElement,\n null\n>;\n\n/**\n * A struct for the {@link FieldElement} type.\n */\nexport const FieldStruct: Describe<FieldElement> = element('Field', {\n label: optional(string()),\n error: optional(string()),\n children: FieldChildStruct,\n});\n\n/**\n * A struct for the {@link BoldElement} type.\n */\nexport const BoldStruct: Describe<BoldElement> = element('Bold', {\n children: children([\n string(),\n // eslint-disable-next-line @typescript-eslint/no-use-before-define\n lazy(() => ItalicStruct) as unknown as Struct<\n SnapElement<JsonObject, 'Italic'>\n >,\n ]),\n});\n\n/**\n * A struct for the {@link ItalicElement} type.\n */\nexport const ItalicStruct: Describe<ItalicElement> = element('Italic', {\n children: children([\n string(),\n // eslint-disable-next-line @typescript-eslint/no-use-before-define\n lazy(() => BoldStruct) as unknown as Struct<\n SnapElement<JsonObject, 'Bold'>\n >,\n ]),\n});\n\nexport const FormattingStruct: Describe<StandardFormattingElement> = typedUnion(\n [BoldStruct, ItalicStruct],\n);\n\n/**\n * A struct for the {@link AvatarElement} type.\n */\nexport const AvatarStruct = element('Avatar', {\n address: CaipAccountIdStruct,\n size: optional(nullUnion([literal('sm'), literal('md'), literal('lg')])),\n}) as unknown as Struct<AvatarElement, null>;\n\nexport const BoxChildrenStruct = children(\n // eslint-disable-next-line @typescript-eslint/no-use-before-define\n [lazy(() => BoxChildStruct)],\n) as unknown as Struct<SnapsChildren<GenericSnapElement>, null>;\n\n/**\n * A struct for the {@link BoxElement} type.\n */\nexport const BoxStruct: Describe<BoxElement> = element('Box', {\n children: BoxChildrenStruct,\n direction: optional(nullUnion([literal('horizontal'), literal('vertical')])),\n alignment: optional(\n nullUnion([\n literal('start'),\n literal('center'),\n literal('end'),\n literal('space-between'),\n literal('space-around'),\n ]),\n ),\n center: optional(boolean()),\n});\n\n/**\n * A subset of JSX elements that are allowed as children of the Form component.\n */\nexport const FormChildStruct = BoxChildrenStruct;\n\n/**\n * A struct for the {@link FormElement} type.\n */\nexport const FormStruct: Describe<FormElement> = element('Form', {\n children: FormChildStruct,\n name: string(),\n});\n\nconst FooterButtonStruct = refine(ButtonStruct, 'FooterButton', (value) => {\n if (\n typeof value.props.children === 'string' ||\n typeof value.props.children === 'boolean' ||\n value.props.children === null\n ) {\n return true;\n }\n\n if (Array.isArray(value.props.children)) {\n const hasNonTextElements = value.props.children.some(\n (child) =>\n typeof child !== 'string' &&\n typeof child !== 'boolean' &&\n child !== null,\n );\n\n if (!hasNonTextElements) {\n return true;\n }\n }\n\n return 'Footer buttons may only contain text.';\n});\n\n/**\n * A struct for the {@link SectionElement} type.\n */\nexport const SectionStruct: Describe<SectionElement> = element('Section', {\n children: BoxChildrenStruct,\n direction: optional(nullUnion([literal('horizontal'), literal('vertical')])),\n alignment: optional(\n nullUnion([\n literal('start'),\n literal('center'),\n literal('end'),\n literal('space-between'),\n literal('space-around'),\n ]),\n ),\n});\n\n/**\n * A subset of JSX elements that are allowed as children of the Footer component.\n * This set should include a single button or a tuple of two buttons.\n */\n\nexport const FooterChildStruct = selectiveUnion((value) => {\n if (Array.isArray(value)) {\n return tuple([FooterButtonStruct, FooterButtonStruct]);\n }\n return FooterButtonStruct;\n});\n\n/**\n * A struct for the {@link FooterElement} type.\n */\nexport const FooterStruct: Describe<FooterElement> = element('Footer', {\n children: FooterChildStruct,\n});\n\n/**\n * A struct for the {@link CopyableElement} type.\n */\nexport const CopyableStruct: Describe<CopyableElement> = element('Copyable', {\n value: string(),\n sensitive: optional(boolean()),\n});\n\n/**\n * A struct for the {@link DividerElement} type.\n */\nexport const DividerStruct: Describe<DividerElement> = element('Divider');\n\n/**\n * A struct for the {@link ValueElement} type.\n */\nexport const ValueStruct: Describe<ValueElement> = element('Value', {\n value: string(),\n extra: string(),\n});\n\n/**\n * A struct for the {@link HeadingElement} type.\n */\nexport const HeadingStruct: Describe<HeadingElement> = element('Heading', {\n children: StringElementStruct,\n size: optional(nullUnion([literal('sm'), literal('md'), literal('lg')])),\n});\n\n/**\n * A struct for the {@link LinkElement} type.\n */\nexport const LinkStruct: Describe<LinkElement> = element('Link', {\n href: string(),\n children: children([\n FormattingStruct,\n string(),\n IconStruct,\n ImageStruct,\n AddressStruct,\n ]),\n});\n\n/**\n * A struct for the {@link TextElement} type.\n */\nexport const TextStruct: Describe<TextElement> = element('Text', {\n children: children([\n selectiveUnion((value) => {\n if (typeof value === 'string') {\n return string();\n }\n return typedUnion([BoldStruct, ItalicStruct, LinkStruct, IconStruct]);\n }),\n ]),\n alignment: optional(\n nullUnion([literal('start'), literal('center'), literal('end')]),\n ),\n color: optional(\n nullUnion([\n literal('default'),\n literal('alternative'),\n literal('muted'),\n literal('error'),\n literal('success'),\n literal('warning'),\n ]),\n ),\n size: optional(nullUnion([literal('sm'), literal('md')])),\n});\n\n/**\n * A subset of JSX elements that are allowed as children of the Tooltip component.\n * This set should include all text components and the Image.\n */\nexport const TooltipChildStruct = selectiveUnion((value) => {\n if (typeof value === 'boolean') {\n return boolean();\n }\n return typedUnion([\n TextStruct,\n BoldStruct,\n ItalicStruct,\n LinkStruct,\n ImageStruct,\n IconStruct,\n ]);\n});\n\n/**\n * A subset of JSX elements that are allowed as content of the Tooltip component.\n * This set should include all text components.\n */\nexport const TooltipContentStruct = selectiveUnion((value) => {\n if (typeof value === 'string') {\n return string();\n }\n return typedUnion([\n TextStruct,\n BoldStruct,\n ItalicStruct,\n LinkStruct,\n IconStruct,\n ]);\n});\n\n/**\n * A struct for the {@link TooltipElement} type.\n */\nexport const TooltipStruct: Describe<TooltipElement> = element('Tooltip', {\n children: nullable(TooltipChildStruct),\n content: TooltipContentStruct,\n});\n\n/**\n * A struct for the {@link RowElement} type.\n */\nexport const RowStruct: Describe<RowElement> = element('Row', {\n label: string(),\n children: typedUnion([\n AddressStruct,\n ImageStruct,\n TextStruct,\n ValueStruct,\n LinkStruct,\n ]),\n variant: optional(\n nullUnion([literal('default'), literal('warning'), literal('critical')]),\n ),\n tooltip: optional(string()),\n});\n\n/**\n * A struct for the {@link SpinnerElement} type.\n */\nexport const SpinnerStruct: Describe<SpinnerElement> = element('Spinner');\n\n/**\n * A subset of JSX elements that are allowed as children of the Box component.\n * This set includes all components, except components that need to be nested in\n * another component (e.g., Field must be contained in a Form).\n */\nexport const BoxChildStruct = typedUnion([\n AddressStruct,\n BoldStruct,\n BoxStruct,\n ButtonStruct,\n CopyableStruct,\n DividerStruct,\n DropdownStruct,\n RadioGroupStruct,\n FieldStruct,\n FileInputStruct,\n FormStruct,\n HeadingStruct,\n InputStruct,\n ImageStruct,\n ItalicStruct,\n LinkStruct,\n RowStruct,\n SpinnerStruct,\n TextStruct,\n TooltipStruct,\n CheckboxStruct,\n CardStruct,\n IconStruct,\n SelectorStruct,\n SectionStruct,\n AvatarStruct,\n]);\n\n/**\n * A struct for the {@link ContainerElement} type.\n */\nexport const ContainerStruct: Describe<ContainerElement> = element(\n 'Container',\n {\n children: selectiveUnion((value) => {\n if (Array.isArray(value)) {\n return tuple([BoxChildStruct, FooterStruct]);\n }\n return BoxChildStruct;\n }) as unknown as Struct<\n [GenericSnapElement, FooterElement] | GenericSnapElement,\n null\n >,\n },\n);\n\n/**\n * For now, the allowed JSX elements at the root are the same as the allowed\n * children of the Box component.\n */\nexport const RootJSXElementStruct = typedUnion([\n BoxChildStruct,\n ContainerStruct,\n]);\n\n/**\n * A struct for the {@link JSXElement} type.\n */\nexport const JSXElementStruct: Describe<JSXElement> = typedUnion([\n ButtonStruct,\n InputStruct,\n FileInputStruct,\n FieldStruct,\n FormStruct,\n BoldStruct,\n ItalicStruct,\n AddressStruct,\n BoxStruct,\n CopyableStruct,\n DividerStruct,\n HeadingStruct,\n ImageStruct,\n LinkStruct,\n RowStruct,\n SpinnerStruct,\n TextStruct,\n DropdownStruct,\n OptionStruct,\n RadioGroupStruct,\n RadioStruct,\n ValueStruct,\n TooltipStruct,\n CheckboxStruct,\n FooterStruct,\n ContainerStruct,\n CardStruct,\n IconStruct,\n SelectorStruct,\n SelectorOptionStruct,\n SectionStruct,\n AvatarStruct,\n]);\n\n/**\n * Check if a value is a JSX element.\n *\n * @param value - The value to check.\n * @returns True if the value is a JSX element, false otherwise.\n */\nexport function isJSXElement(value: unknown): value is JSXElement {\n return is(value, JSXElementStruct);\n}\n\n/**\n * Check if a value is a JSX element, without validating all of its contents.\n * This is useful when you want to validate the structure of a value, but not\n * all the children.\n *\n * This should only be used when you are sure that the value is safe to use,\n * i.e., after using {@link isJSXElement}.\n *\n * @param value - The value to check.\n * @returns True if the value is a JSX element, false otherwise.\n */\nexport function isJSXElementUnsafe(value: unknown): value is JSXElement {\n return (\n isPlainObject(value) &&\n hasProperty(value, 'type') &&\n hasProperty(value, 'props') &&\n hasProperty(value, 'key')\n );\n}\n\n/**\n * Assert that a value is a JSX element.\n *\n * @param value - The value to check.\n * @throws If the value is not a JSX element.\n */\nexport function assertJSXElement(value: unknown): asserts value is JSXElement {\n // TODO: We should use the error parsing utils from `snaps-utils` to improve\n // the error messages. It currently includes colours and potentially other\n // formatting that we might not want to include in the SDK.\n if (!isJSXElement(value)) {\n throw new Error(\n `Expected a JSX element, but received ${JSON.stringify(\n value,\n )}. Please refer to the documentation for the supported JSX elements and their props.`,\n );\n }\n}\n"]}
1
+ {"version":3,"file":"validation.cjs","sourceRoot":"","sources":["../../src/jsx/validation.ts"],"names":[],"mappings":";;;;AAOA,uDAe+B;AAC/B,2CAMyB;AAGzB,sDAMsB;AAatB,uDAoCsB;AAEtB;;GAEG;AACU,QAAA,SAAS,GAAkB,IAAA,qBAAS,EAAC,CAAC,IAAA,oBAAM,GAAE,EAAE,IAAA,oBAAM,GAAE,CAAC,CAAC,CAAC;AAExE;;GAEG;AACU,QAAA,mBAAmB,GAA4B,QAAQ,CAAC;IACnE,IAAA,oBAAM,GAAE;CACT,CAAC,CAAC;AAEH;;GAEG;AACU,QAAA,aAAa,GAAiC,IAAA,oBAAM,EAAC;IAChE,IAAI,EAAE,IAAA,oBAAM,GAAE;IACd,KAAK,EAAE,IAAA,oBAAM,EAAC,IAAA,oBAAM,GAAE,EAAE,kBAAU,CAAC;IACnC,GAAG,EAAE,IAAA,sBAAQ,EAAC,iBAAS,CAAC;CACzB,CAAC,CAAC;AAEH;;;;;GAKG;AACH,SAAS,QAAQ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,\n InferStructTuple,\n ObjectSchema,\n Struct,\n} from '@metamask/superstruct';\nimport {\n is,\n boolean,\n optional,\n array,\n lazy,\n nullable,\n number,\n object,\n record,\n string,\n tuple,\n refine,\n assign,\n union,\n} from '@metamask/superstruct';\nimport {\n CaipAccountIdStruct,\n hasProperty,\n HexChecksumAddressStruct,\n isPlainObject,\n JsonStruct,\n} from '@metamask/utils';\n\nimport type { Describe } from '../internals';\nimport {\n literal,\n nullUnion,\n selectiveUnion,\n svg,\n typedUnion,\n} from '../internals';\nimport type { EmptyObject } from '../types';\nimport type {\n GenericSnapChildren,\n GenericSnapElement,\n JsonObject,\n Key,\n Nestable,\n SnapElement,\n SnapsChildren,\n StringElement,\n} from './component';\nimport type { AvatarElement } from './components';\nimport {\n type AddressElement,\n type BoldElement,\n type BoxElement,\n type ButtonElement,\n type CheckboxElement,\n type CardElement,\n type CopyableElement,\n type DividerElement,\n type DropdownElement,\n type OptionElement,\n type RadioElement,\n type RadioGroupElement,\n type FieldElement,\n type FormElement,\n type HeadingElement,\n type ImageElement,\n type InputElement,\n type ItalicElement,\n type JSXElement,\n type LinkElement,\n type RowElement,\n type SpinnerElement,\n type StandardFormattingElement,\n type TextElement,\n type TooltipElement,\n type ValueElement,\n type FileInputElement,\n type ContainerElement,\n type FooterElement,\n type IconElement,\n type SectionElement,\n type SelectorElement,\n type SelectorOptionElement,\n type BannerElement,\n IconName,\n} from './components';\n\n/**\n * A struct for the {@link Key} type.\n */\nexport const KeyStruct: Describe<Key> = nullUnion([string(), number()]);\n\n/**\n * A struct for the {@link StringElement} type.\n */\nexport const StringElementStruct: Describe<StringElement> = children([\n string(),\n]);\n\n/**\n * A struct for the {@link GenericSnapElement} type.\n */\nexport const ElementStruct: Describe<GenericSnapElement> = object({\n type: string(),\n props: record(string(), JsonStruct),\n key: nullable(KeyStruct),\n});\n\n/**\n * A helper function for creating a struct for a {@link Nestable} type.\n *\n * @param struct - The struct for the type to test.\n * @returns The struct for the nestable type.\n */\nfunction nestable<Type, Schema>(\n struct: Struct<Type, Schema>,\n): Struct<Nestable<Type>, any> {\n const nestableStruct: Struct<Nestable<Type>> = selectiveUnion((value) => {\n if (Array.isArray(value)) {\n return array(lazy(() => nestableStruct));\n }\n return struct;\n });\n\n return nestableStruct;\n}\n\n/**\n * A helper function for creating a struct which allows children of a specific\n * type, as well as `null` and `boolean`.\n *\n * @param structs - The structs to allow as children.\n * @returns The struct for the children.\n */\nfunction children<Head extends AnyStruct, Tail extends AnyStruct[]>(\n structs: [head: Head, ...tail: Tail],\n): Struct<\n Nestable<Infer<Head> | InferStructTuple<Tail>[number] | boolean | null>,\n null\n> {\n return nestable(\n nullable(\n selectiveUnion((value) => {\n if (typeof value === 'boolean') {\n return boolean();\n }\n if (structs.length === 1) {\n return structs[0];\n }\n return nullUnion(structs);\n }),\n ),\n ) as unknown as Struct<\n Nestable<Infer<Head> | InferStructTuple<Tail>[number] | boolean | null>,\n null\n >;\n}\n\n/**\n * A helper function for creating a struct which allows a single child of a specific\n * type, as well as `null` and `boolean`.\n *\n * @param struct - The struct to allow as a single child.\n * @returns The struct for the children.\n */\nfunction singleChild<Type extends AnyStruct>(\n struct: Type,\n): Struct<Infer<Type> | boolean | null, null> {\n return nullable(\n selectiveUnion((value) => {\n if (typeof value === 'boolean') {\n return boolean();\n }\n\n return struct;\n }),\n ) as unknown as Struct<Infer<Type> | boolean | null, null>;\n}\n\n/**\n * A helper function for creating a struct for a JSX element.\n *\n * @param name - The name of the element.\n * @param props - The props of the element.\n * @returns The struct for the element.\n */\nfunction element<Name extends string, Props extends ObjectSchema = EmptyObject>(\n name: Name,\n props: Props = {} as Props,\n) {\n return object({\n type: literal(name) as unknown as Struct<Name, Name>,\n props: object(props),\n key: nullable(KeyStruct),\n });\n}\n\n/**\n * A helper function for creating a struct for a JSX element with selective props.\n *\n * @param name - The name of the element.\n * @param selector - The selector function choosing the struct to validate with.\n * @returns The struct for the element.\n */\nfunction elementWithSelectiveProps<\n Name extends string,\n Selector extends (value: any) => AnyStruct,\n>(name: Name, selector: Selector) {\n return object({\n type: literal(name) as unknown as Struct<Name, Name>,\n props: selectiveUnion(selector),\n key: nullable(KeyStruct),\n });\n}\n\n/**\n * A struct for the {@link ImageElement} type.\n */\nexport const ImageStruct: Describe<ImageElement> = element('Image', {\n src: svg(),\n alt: optional(string()),\n});\n\nconst IconNameStruct: Struct<`${IconName}`, null> = nullUnion(\n Object.values(IconName).map((name) => literal(name)) as any,\n);\n\n/**\n * A struct for the {@link IconElement} type.\n */\nexport const IconStruct: Describe<IconElement> = element('Icon', {\n name: IconNameStruct,\n color: optional(\n nullUnion([literal('default'), literal('primary'), literal('muted')]),\n ),\n size: optional(nullUnion([literal('md'), literal('inherit')])),\n});\n\n/**\n * A struct for the {@link ButtonElement} type.\n */\nexport const ButtonStruct: Describe<ButtonElement> = element('Button', {\n children: children([StringElementStruct, ImageStruct, IconStruct]),\n name: optional(string()),\n type: optional(nullUnion([literal('button'), literal('submit')])),\n variant: optional(nullUnion([literal('primary'), literal('destructive')])),\n size: optional(nullUnion([literal('sm'), literal('md')])),\n disabled: optional(boolean()),\n loading: optional(boolean()),\n form: optional(string()),\n});\n\n/**\n * A struct for the {@link CheckboxElement} type.\n */\nexport const CheckboxStruct: Describe<CheckboxElement> = element('Checkbox', {\n name: string(),\n checked: optional(boolean()),\n label: optional(string()),\n variant: optional(nullUnion([literal('default'), literal('toggle')])),\n});\n\n/**\n * A struct for the generic input element props.\n */\nexport const GenericInputPropsStruct = object({\n name: string(),\n value: optional(string()),\n placeholder: optional(string()),\n});\n\n/**\n * A struct for the text type input props.\n */\nexport const TextInputPropsStruct = assign(\n GenericInputPropsStruct,\n object({\n type: literal('text'),\n }),\n);\n\n/**\n * A struct for the password type input props.\n */\nexport const PasswordInputPropsStruct = assign(\n GenericInputPropsStruct,\n object({\n type: literal('password'),\n }),\n);\n\n/**\n * A struct for the number type input props.\n */\nexport const NumberInputPropsStruct = assign(\n GenericInputPropsStruct,\n object({\n type: literal('number'),\n min: optional(number()),\n max: optional(number()),\n step: optional(number()),\n }),\n);\n\n/**\n * A struct for the {@link InputElement} type.\n */\nexport const InputStruct: Describe<InputElement> = elementWithSelectiveProps(\n 'Input',\n (value) => {\n if (isPlainObject(value) && hasProperty(value, 'type')) {\n switch (value.type) {\n case 'text':\n return TextInputPropsStruct;\n case 'password':\n return PasswordInputPropsStruct;\n case 'number':\n return NumberInputPropsStruct;\n default:\n return GenericInputPropsStruct;\n }\n }\n return GenericInputPropsStruct;\n },\n);\n\n/**\n * A struct for the {@link OptionElement} type.\n */\nexport const OptionStruct: Describe<OptionElement> = element('Option', {\n value: string(),\n children: string(),\n});\n\n/**\n * A struct for the {@link DropdownElement} type.\n */\nexport const DropdownStruct: Describe<DropdownElement> = element('Dropdown', {\n name: string(),\n value: optional(string()),\n children: children([OptionStruct]),\n});\n\n/**\n * A struct for the {@link AddressElement} type.\n */\nexport const AddressStruct: Describe<AddressElement> = element('Address', {\n address: nullUnion([HexChecksumAddressStruct, CaipAccountIdStruct]),\n truncate: optional(boolean()),\n displayName: optional(boolean()),\n avatar: optional(boolean()),\n});\n\n/**\n * A struct for the {@link CardElement} type.\n */\nexport const CardStruct: Describe<CardElement> = element('Card', {\n image: optional(string()),\n title: selectiveUnion((value) => {\n if (typeof value === 'object') {\n return AddressStruct;\n }\n return string();\n }),\n description: optional(string()),\n value: string(),\n extra: optional(string()),\n});\n\n/**\n * A struct for the {@link SelectorOptionElement} type.\n */\nexport const SelectorOptionStruct: Describe<SelectorOptionElement> = element(\n 'SelectorOption',\n {\n value: string(),\n children: CardStruct,\n },\n);\n\n/**\n * A struct for the {@link SelectorElement} type.\n */\nexport const SelectorStruct: Describe<SelectorElement> = element('Selector', {\n name: string(),\n title: string(),\n value: optional(string()),\n children: children([SelectorOptionStruct]),\n});\n\n/**\n * A struct for the {@link RadioElement} type.\n */\nexport const RadioStruct: Describe<RadioElement> = element('Radio', {\n value: string(),\n children: string(),\n});\n\n/**\n * A struct for the {@link RadioGroupElement} type.\n */\nexport const RadioGroupStruct: Describe<RadioGroupElement> = element(\n 'RadioGroup',\n {\n name: string(),\n value: optional(string()),\n children: children([RadioStruct]),\n },\n);\n\n/**\n * A struct for the {@link FileInputElement} type.\n */\nexport const FileInputStruct: Describe<FileInputElement> = element(\n 'FileInput',\n {\n name: string(),\n accept: nullUnion([optional(array(string()))]),\n compact: optional(boolean()),\n },\n);\n\n/**\n * A subset of JSX elements that represent the tuple Box + Input of the Field children.\n */\nconst BOX_INPUT_LEFT = [\n // eslint-disable-next-line @typescript-eslint/no-use-before-define\n singleChild(lazy(() => BoxChildStruct)),\n InputStruct,\n] as [typeof BoxChildStruct, typeof InputStruct];\n\n/**\n * A subset of JSX elements that represent the tuple Input + Box of the Field children.\n */\nconst BOX_INPUT_RIGHT = [\n InputStruct,\n // eslint-disable-next-line @typescript-eslint/no-use-before-define\n singleChild(lazy(() => BoxChildStruct)),\n] as [typeof InputStruct, typeof BoxChildStruct];\n\n/**\n * A subset of JSX elements that represent the tuple Box + Input + Box of the Field children.\n */\nconst BOX_INPUT_BOTH = [\n // eslint-disable-next-line @typescript-eslint/no-use-before-define\n singleChild(lazy(() => BoxChildStruct)),\n InputStruct,\n // eslint-disable-next-line @typescript-eslint/no-use-before-define\n singleChild(lazy(() => BoxChildStruct)),\n] as [typeof BoxChildStruct, typeof InputStruct, typeof BoxChildStruct];\n\n/**\n * A subset of JSX elements that are allowed as single children of the Field component.\n */\nconst FIELD_CHILDREN_ARRAY = [\n InputStruct,\n DropdownStruct,\n RadioGroupStruct,\n FileInputStruct,\n CheckboxStruct,\n SelectorStruct,\n] as [\n typeof InputStruct,\n typeof DropdownStruct,\n typeof RadioGroupStruct,\n typeof FileInputStruct,\n typeof CheckboxStruct,\n typeof SelectorStruct,\n];\n\n/**\n * A union of the allowed children of the Field component.\n * This is mainly used in the simulator for validation purposes.\n */\nexport const FieldChildUnionStruct = nullUnion([\n ...FIELD_CHILDREN_ARRAY,\n ...BOX_INPUT_LEFT,\n ...BOX_INPUT_RIGHT,\n ...BOX_INPUT_BOTH,\n]);\n\n/**\n * A subset of JSX elements that are allowed as children of the Field component.\n */\nconst FieldChildStruct = selectiveUnion((value) => {\n const isArray = Array.isArray(value);\n if (isArray && value.length === 3) {\n return tuple(BOX_INPUT_BOTH);\n }\n\n if (isArray && value.length === 2) {\n return value[0]?.type === 'Box'\n ? tuple(BOX_INPUT_LEFT)\n : tuple(BOX_INPUT_RIGHT);\n }\n\n return typedUnion(FIELD_CHILDREN_ARRAY);\n}) as unknown as Struct<\n | [InputElement, GenericSnapChildren]\n | [GenericSnapChildren, InputElement]\n | [GenericSnapChildren, InputElement, GenericSnapChildren]\n | DropdownElement\n | RadioGroupElement\n | FileInputElement\n | InputElement\n | CheckboxElement\n | SelectorElement,\n null\n>;\n\n/**\n * A struct for the {@link FieldElement} type.\n */\nexport const FieldStruct: Describe<FieldElement> = element('Field', {\n label: optional(string()),\n error: optional(string()),\n children: FieldChildStruct,\n});\n\n/**\n * A struct for the {@link BoldElement} type.\n */\nexport const BoldStruct: Describe<BoldElement> = element('Bold', {\n children: children([\n string(),\n // eslint-disable-next-line @typescript-eslint/no-use-before-define\n lazy(() => ItalicStruct) as unknown as Struct<\n SnapElement<JsonObject, 'Italic'>\n >,\n ]),\n});\n\n/**\n * A struct for the {@link ItalicElement} type.\n */\nexport const ItalicStruct: Describe<ItalicElement> = element('Italic', {\n children: children([\n string(),\n // eslint-disable-next-line @typescript-eslint/no-use-before-define\n lazy(() => BoldStruct) as unknown as Struct<\n SnapElement<JsonObject, 'Bold'>\n >,\n ]),\n});\n\nexport const FormattingStruct: Describe<StandardFormattingElement> = typedUnion(\n [BoldStruct, ItalicStruct],\n);\n\n/**\n * A struct for the {@link AvatarElement} type.\n */\nexport const AvatarStruct = element('Avatar', {\n address: CaipAccountIdStruct,\n size: optional(nullUnion([literal('sm'), literal('md'), literal('lg')])),\n}) as unknown as Struct<AvatarElement, null>;\n\nexport const BoxChildrenStruct = children(\n // eslint-disable-next-line @typescript-eslint/no-use-before-define\n [lazy(() => BoxChildStruct)],\n) as unknown as Struct<SnapsChildren<GenericSnapElement>, null>;\n\n/**\n * A struct for the {@link BoxElement} type.\n */\nexport const BoxStruct: Describe<BoxElement> = element('Box', {\n children: BoxChildrenStruct,\n direction: optional(nullUnion([literal('horizontal'), literal('vertical')])),\n alignment: optional(\n nullUnion([\n literal('start'),\n literal('center'),\n literal('end'),\n literal('space-between'),\n literal('space-around'),\n ]),\n ),\n center: optional(boolean()),\n});\n\n/**\n * A subset of JSX elements that are allowed as children of the Form component.\n */\nexport const FormChildStruct = BoxChildrenStruct;\n\n/**\n * A struct for the {@link FormElement} type.\n */\nexport const FormStruct: Describe<FormElement> = element('Form', {\n children: FormChildStruct,\n name: string(),\n});\n\nconst FooterButtonStruct = refine(ButtonStruct, 'FooterButton', (value) => {\n if (\n typeof value.props.children === 'string' ||\n typeof value.props.children === 'boolean' ||\n value.props.children === null\n ) {\n return true;\n }\n\n if (Array.isArray(value.props.children)) {\n const hasNonTextElements = value.props.children.some(\n (child) =>\n typeof child !== 'string' &&\n typeof child !== 'boolean' &&\n child !== null,\n );\n\n if (!hasNonTextElements) {\n return true;\n }\n }\n\n return 'Footer buttons may only contain text.';\n});\n\n/**\n * A struct for the {@link SectionElement} type.\n */\nexport const SectionStruct: Describe<SectionElement> = element('Section', {\n children: BoxChildrenStruct,\n direction: optional(nullUnion([literal('horizontal'), literal('vertical')])),\n alignment: optional(\n nullUnion([\n literal('start'),\n literal('center'),\n literal('end'),\n literal('space-between'),\n literal('space-around'),\n ]),\n ),\n});\n\n/**\n * A subset of JSX elements that are allowed as children of the Footer component.\n * This set should include a single button or a tuple of two buttons.\n */\n\nexport const FooterChildStruct = selectiveUnion((value) => {\n if (Array.isArray(value)) {\n return tuple([FooterButtonStruct, FooterButtonStruct]);\n }\n return FooterButtonStruct;\n});\n\n/**\n * A struct for the {@link FooterElement} type.\n */\nexport const FooterStruct: Describe<FooterElement> = element('Footer', {\n children: FooterChildStruct,\n});\n\n/**\n * A struct for the {@link CopyableElement} type.\n */\nexport const CopyableStruct: Describe<CopyableElement> = element('Copyable', {\n value: string(),\n sensitive: optional(boolean()),\n});\n\n/**\n * A struct for the {@link DividerElement} type.\n */\nexport const DividerStruct: Describe<DividerElement> = element('Divider');\n\n/**\n * A struct for the {@link ValueElement} type.\n */\nexport const ValueStruct: Describe<ValueElement> = element('Value', {\n value: string(),\n extra: string(),\n});\n\n/**\n * A struct for the {@link HeadingElement} type.\n */\nexport const HeadingStruct: Describe<HeadingElement> = element('Heading', {\n children: StringElementStruct,\n size: optional(nullUnion([literal('sm'), literal('md'), literal('lg')])),\n});\n\n/**\n * A struct for the {@link LinkElement} type.\n */\nexport const LinkStruct: Describe<LinkElement> = element('Link', {\n href: string(),\n children: children([\n FormattingStruct,\n string(),\n IconStruct,\n ImageStruct,\n AddressStruct,\n ]),\n});\n\n/**\n * A struct for the {@link TextElement} type.\n */\nexport const TextStruct: Describe<TextElement> = element('Text', {\n children: children([\n selectiveUnion((value) => {\n if (typeof value === 'string') {\n return string();\n }\n return typedUnion([BoldStruct, ItalicStruct, LinkStruct, IconStruct]);\n }),\n ]),\n alignment: optional(\n nullUnion([literal('start'), literal('center'), literal('end')]),\n ),\n color: optional(\n nullUnion([\n literal('default'),\n literal('alternative'),\n literal('muted'),\n literal('error'),\n literal('success'),\n literal('warning'),\n ]),\n ),\n size: optional(nullUnion([literal('sm'), literal('md')])),\n fontWeight: optional(\n nullUnion([literal('regular'), literal('medium'), literal('bold')]),\n ),\n});\n\n/**\n * A subset of JSX elements that are allowed as children of the Tooltip component.\n * This set should include all text components and the Image.\n */\nexport const TooltipChildStruct = selectiveUnion((value) => {\n if (typeof value === 'boolean') {\n return boolean();\n }\n return typedUnion([\n TextStruct,\n BoldStruct,\n ItalicStruct,\n LinkStruct,\n ImageStruct,\n IconStruct,\n ]);\n});\n\n/**\n * A subset of JSX elements that are allowed as content of the Tooltip component.\n * This set should include all text components.\n */\nexport const TooltipContentStruct = selectiveUnion((value) => {\n if (typeof value === 'string') {\n return string();\n }\n return typedUnion([\n TextStruct,\n BoldStruct,\n ItalicStruct,\n LinkStruct,\n IconStruct,\n ]);\n});\n\n/**\n * A struct for the {@link TooltipElement} type.\n */\nexport const TooltipStruct: Describe<TooltipElement> = element('Tooltip', {\n children: nullable(TooltipChildStruct),\n content: TooltipContentStruct,\n});\n\n/**\n * A struct for the {@link BannerElement} type.\n */\nexport const BannerStruct: Describe<BannerElement> = element('Banner', {\n children: children([\n TextStruct,\n LinkStruct,\n IconStruct,\n ButtonStruct,\n BoldStruct,\n ItalicStruct,\n ]),\n title: string(),\n severity: union([\n literal('danger'),\n literal('info'),\n literal('success'),\n literal('warning'),\n ]),\n});\n\n/**\n * A struct for the {@link RowElement} type.\n */\nexport const RowStruct: Describe<RowElement> = element('Row', {\n label: string(),\n children: typedUnion([\n AddressStruct,\n ImageStruct,\n TextStruct,\n ValueStruct,\n LinkStruct,\n ]),\n variant: optional(\n nullUnion([literal('default'), literal('warning'), literal('critical')]),\n ),\n tooltip: optional(string()),\n});\n\n/**\n * A struct for the {@link SpinnerElement} type.\n */\nexport const SpinnerStruct: Describe<SpinnerElement> = element('Spinner');\n\n/**\n * A subset of JSX elements that are allowed as children of the Box component.\n * This set includes all components, except components that need to be nested in\n * another component (e.g., Field must be contained in a Form).\n */\nexport const BoxChildStruct = typedUnion([\n AddressStruct,\n BoldStruct,\n BoxStruct,\n ButtonStruct,\n CopyableStruct,\n DividerStruct,\n DropdownStruct,\n RadioGroupStruct,\n FieldStruct,\n FileInputStruct,\n FormStruct,\n HeadingStruct,\n InputStruct,\n ImageStruct,\n ItalicStruct,\n LinkStruct,\n RowStruct,\n SpinnerStruct,\n TextStruct,\n TooltipStruct,\n CheckboxStruct,\n CardStruct,\n IconStruct,\n SelectorStruct,\n SectionStruct,\n AvatarStruct,\n BannerStruct,\n]);\n\n/**\n * A struct for the {@link ContainerElement} type.\n */\nexport const ContainerStruct: Describe<ContainerElement> = element(\n 'Container',\n {\n children: selectiveUnion((value) => {\n if (Array.isArray(value)) {\n return tuple([BoxChildStruct, FooterStruct]);\n }\n return BoxChildStruct;\n }) as unknown as Struct<\n [GenericSnapElement, FooterElement] | GenericSnapElement,\n null\n >,\n },\n);\n\n/**\n * For now, the allowed JSX elements at the root are the same as the allowed\n * children of the Box component.\n */\nexport const RootJSXElementStruct = typedUnion([\n BoxChildStruct,\n ContainerStruct,\n]);\n\n/**\n * A struct for the {@link JSXElement} type.\n */\nexport const JSXElementStruct: Describe<JSXElement> = typedUnion([\n ButtonStruct,\n InputStruct,\n FileInputStruct,\n FieldStruct,\n FormStruct,\n BoldStruct,\n ItalicStruct,\n AddressStruct,\n BoxStruct,\n CopyableStruct,\n DividerStruct,\n HeadingStruct,\n ImageStruct,\n LinkStruct,\n RowStruct,\n SpinnerStruct,\n TextStruct,\n DropdownStruct,\n OptionStruct,\n RadioGroupStruct,\n RadioStruct,\n ValueStruct,\n TooltipStruct,\n CheckboxStruct,\n FooterStruct,\n ContainerStruct,\n CardStruct,\n IconStruct,\n SelectorStruct,\n SelectorOptionStruct,\n SectionStruct,\n AvatarStruct,\n BannerStruct,\n]);\n\n/**\n * Check if a value is a JSX element.\n *\n * @param value - The value to check.\n * @returns True if the value is a JSX element, false otherwise.\n */\nexport function isJSXElement(value: unknown): value is JSXElement {\n return is(value, JSXElementStruct);\n}\n\n/**\n * Check if a value is a JSX element, without validating all of its contents.\n * This is useful when you want to validate the structure of a value, but not\n * all the children.\n *\n * This should only be used when you are sure that the value is safe to use,\n * i.e., after using {@link isJSXElement}.\n *\n * @param value - The value to check.\n * @returns True if the value is a JSX element, false otherwise.\n */\nexport function isJSXElementUnsafe(value: unknown): value is JSXElement {\n return (\n isPlainObject(value) &&\n hasProperty(value, 'type') &&\n hasProperty(value, 'props') &&\n hasProperty(value, 'key')\n );\n}\n\n/**\n * Assert that a value is a JSX element.\n *\n * @param value - The value to check.\n * @throws If the value is not a JSX element.\n */\nexport function assertJSXElement(value: unknown): asserts value is JSXElement {\n // TODO: We should use the error parsing utils from `snaps-utils` to improve\n // the error messages. It currently includes colours and potentially other\n // formatting that we might not want to include in the SDK.\n if (!isJSXElement(value)) {\n throw new Error(\n `Expected a JSX element, but received ${JSON.stringify(\n value,\n )}. Please refer to the documentation for the supported JSX elements and their props.`,\n );\n }\n}\n"]}
@@ -1,7 +1,7 @@
1
1
  import type { Struct } from "@metamask/superstruct";
2
2
  import type { Describe } from "../internals/index.cjs";
3
3
  import type { GenericSnapElement, Key, SnapElement, SnapsChildren, StringElement } from "./component.cjs";
4
- import { type AddressElement, type BoldElement, type BoxElement, type ButtonElement, type CheckboxElement, type CardElement, type CopyableElement, type DividerElement, type DropdownElement, type OptionElement, type RadioElement, type RadioGroupElement, type FieldElement, type FormElement, type HeadingElement, type ImageElement, type InputElement, type ItalicElement, type JSXElement, type LinkElement, type RowElement, type SpinnerElement, type StandardFormattingElement, type TextElement, type TooltipElement, type ValueElement, type FileInputElement, type ContainerElement, type FooterElement, type IconElement, type SectionElement, type SelectorElement, type SelectorOptionElement } from "./components/index.cjs";
4
+ import { type AddressElement, type BoldElement, type BoxElement, type ButtonElement, type CheckboxElement, type CardElement, type CopyableElement, type DividerElement, type DropdownElement, type OptionElement, type RadioElement, type RadioGroupElement, type FieldElement, type FormElement, type HeadingElement, type ImageElement, type InputElement, type ItalicElement, type JSXElement, type LinkElement, type RowElement, type SpinnerElement, type StandardFormattingElement, type TextElement, type TooltipElement, type ValueElement, type FileInputElement, type ContainerElement, type FooterElement, type IconElement, type SectionElement, type SelectorElement, type SelectorOptionElement, type BannerElement } from "./components/index.cjs";
5
5
  /**
6
6
  * A struct for the {@link Key} type.
7
7
  */
@@ -147,7 +147,7 @@ export declare const FieldChildUnionStruct: Struct<SnapElement<import("./compone
147
147
  }, "RadioGroup"> | SnapElement<import("./components/index.cjs").FileInputProps, "FileInput"> | SnapElement<import("./components/index.cjs").AddressProps, "Address"> | SnapElement<import("./components/index.cjs").CardProps, "Card"> | SnapElement<import("./components/index.cjs").SelectorProps, "Selector"> | SnapElement<import("./components/index.cjs").FieldProps, "Field"> | SnapElement<import("./components/index.cjs").BoldProps, "Bold"> | SnapElement<import("./components/index.cjs").ItalicProps, "Italic"> | SnapElement<import("./components/index.cjs").AvatarProps, "Avatar"> | SnapElement<import("./components/index.cjs").BoxProps, "Box"> | SnapElement<import("./components/index.cjs").CopyableProps, "Copyable"> | SnapElement<Record<string, never>, "Divider"> | SnapElement<{
148
148
  children: StringElement;
149
149
  size?: "md" | "sm" | "lg" | undefined;
150
- }, "Heading"> | SnapElement<import("./components/index.cjs").LinkProps, "Link"> | SnapElement<import("./components/index.cjs").TextProps, "Text"> | SnapElement<import("./components/index.cjs").RowProps, "Row"> | SnapElement<import("./components/index.cjs").SectionProps, "Section"> | SnapElement<Record<string, never>, "Spinner"> | SnapElement<import("./components/index.cjs").TooltipProps, "Tooltip">, null>;
150
+ }, "Heading"> | SnapElement<import("./components/index.cjs").LinkProps, "Link"> | SnapElement<import("./components/index.cjs").TextProps, "Text"> | SnapElement<import("./components/index.cjs").RowProps, "Row"> | SnapElement<import("./components/index.cjs").SectionProps, "Section"> | SnapElement<Record<string, never>, "Spinner"> | SnapElement<import("./components/index.cjs").TooltipProps, "Tooltip"> | SnapElement<import("./components/index.cjs").BannerProps, "Banner">, null>;
151
151
  /**
152
152
  * A struct for the {@link FieldElement} type.
153
153
  */
@@ -232,6 +232,10 @@ export declare const TooltipContentStruct: Struct<string | SnapElement<import(".
232
232
  * A struct for the {@link TooltipElement} type.
233
233
  */
234
234
  export declare const TooltipStruct: Describe<TooltipElement>;
235
+ /**
236
+ * A struct for the {@link BannerElement} type.
237
+ */
238
+ export declare const BannerStruct: Describe<BannerElement>;
235
239
  /**
236
240
  * A struct for the {@link RowElement} type.
237
241
  */
@@ -258,7 +262,7 @@ export declare const BoxChildStruct: Struct<SnapElement<import("./components/ind
258
262
  }, "RadioGroup"> | SnapElement<import("./components/index.cjs").FileInputProps, "FileInput"> | SnapElement<import("./components/index.cjs").AddressProps, "Address"> | SnapElement<import("./components/index.cjs").CardProps, "Card"> | SnapElement<import("./components/index.cjs").SelectorProps, "Selector"> | SnapElement<import("./components/index.cjs").FieldProps, "Field"> | SnapElement<import("./components/index.cjs").BoldProps, "Bold"> | SnapElement<import("./components/index.cjs").ItalicProps, "Italic"> | SnapElement<import("./components/index.cjs").AvatarProps, "Avatar"> | SnapElement<import("./components/index.cjs").BoxProps, "Box"> | SnapElement<import("./components/index.cjs").CopyableProps, "Copyable"> | SnapElement<Record<string, never>, "Divider"> | SnapElement<{
259
263
  children: StringElement;
260
264
  size?: "md" | "sm" | "lg" | undefined;
261
- }, "Heading"> | SnapElement<import("./components/index.cjs").LinkProps, "Link"> | SnapElement<import("./components/index.cjs").TextProps, "Text"> | SnapElement<import("./components/index.cjs").RowProps, "Row"> | SnapElement<import("./components/index.cjs").SectionProps, "Section"> | SnapElement<Record<string, never>, "Spinner"> | SnapElement<import("./components/index.cjs").TooltipProps, "Tooltip">, null>;
265
+ }, "Heading"> | SnapElement<import("./components/index.cjs").LinkProps, "Link"> | SnapElement<import("./components/index.cjs").TextProps, "Text"> | SnapElement<import("./components/index.cjs").RowProps, "Row"> | SnapElement<import("./components/index.cjs").SectionProps, "Section"> | SnapElement<Record<string, never>, "Spinner"> | SnapElement<import("./components/index.cjs").TooltipProps, "Tooltip"> | SnapElement<import("./components/index.cjs").BannerProps, "Banner">, null>;
262
266
  /**
263
267
  * A struct for the {@link ContainerElement} type.
264
268
  */
@@ -280,7 +284,7 @@ export declare const RootJSXElementStruct: Struct<SnapElement<import("./componen
280
284
  }, "RadioGroup"> | SnapElement<import("./components/index.cjs").FileInputProps, "FileInput"> | SnapElement<import("./components/index.cjs").AddressProps, "Address"> | SnapElement<import("./components/index.cjs").CardProps, "Card"> | SnapElement<import("./components/index.cjs").SelectorProps, "Selector"> | SnapElement<import("./components/index.cjs").FieldProps, "Field"> | SnapElement<import("./components/index.cjs").BoldProps, "Bold"> | SnapElement<import("./components/index.cjs").ItalicProps, "Italic"> | SnapElement<import("./components/index.cjs").AvatarProps, "Avatar"> | SnapElement<import("./components/index.cjs").BoxProps, "Box"> | SnapElement<import("./components/index.cjs").ContainerProps, "Container"> | SnapElement<import("./components/index.cjs").CopyableProps, "Copyable"> | SnapElement<Record<string, never>, "Divider"> | SnapElement<{
281
285
  children: StringElement;
282
286
  size?: "md" | "sm" | "lg" | undefined;
283
- }, "Heading"> | SnapElement<import("./components/index.cjs").LinkProps, "Link"> | SnapElement<import("./components/index.cjs").TextProps, "Text"> | SnapElement<import("./components/index.cjs").RowProps, "Row"> | SnapElement<import("./components/index.cjs").SectionProps, "Section"> | SnapElement<Record<string, never>, "Spinner"> | SnapElement<import("./components/index.cjs").TooltipProps, "Tooltip">, null>;
287
+ }, "Heading"> | SnapElement<import("./components/index.cjs").LinkProps, "Link"> | SnapElement<import("./components/index.cjs").TextProps, "Text"> | SnapElement<import("./components/index.cjs").RowProps, "Row"> | SnapElement<import("./components/index.cjs").SectionProps, "Section"> | SnapElement<Record<string, never>, "Spinner"> | SnapElement<import("./components/index.cjs").TooltipProps, "Tooltip"> | SnapElement<import("./components/index.cjs").BannerProps, "Banner">, null>;
284
288
  /**
285
289
  * A struct for the {@link JSXElement} type.
286
290
  */
@@ -1 +1 @@
1
- {"version":3,"file":"validation.d.cts","sourceRoot":"","sources":["../../src/jsx/validation.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAKV,MAAM,EACP,8BAA8B;AAwB/B,OAAO,KAAK,EAAE,QAAQ,EAAE,+BAAqB;AAS7C,OAAO,KAAK,EAEV,kBAAkB,EAElB,GAAG,EAEH,WAAW,EACX,aAAa,EACb,aAAa,EACd,wBAAoB;AAErB,OAAO,EACL,KAAK,cAAc,EACnB,KAAK,WAAW,EAChB,KAAK,UAAU,EACf,KAAK,aAAa,EAClB,KAAK,eAAe,EACpB,KAAK,WAAW,EAChB,KAAK,eAAe,EACpB,KAAK,cAAc,EACnB,KAAK,eAAe,EACpB,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;;GAEG;AACH,eAAO,MAAM,gBAAgB,EAAE,QAAQ,CAAC,UAAU,CAkChD,CAAC;AAEH;;;;;GAKG;AACH,wBAAgB,YAAY,CAAC,KAAK,EAAE,OAAO,GAAG,KAAK,IAAI,UAAU,CAEhE;AAED;;;;;;;;;;GAUG;AACH,wBAAgB,kBAAkB,CAAC,KAAK,EAAE,OAAO,GAAG,KAAK,IAAI,UAAU,CAOtE;AAED;;;;;GAKG;AACH,wBAAgB,gBAAgB,CAAC,KAAK,EAAE,OAAO,GAAG,OAAO,CAAC,KAAK,IAAI,UAAU,CAW5E"}
@@ -1,7 +1,7 @@
1
1
  import type { Struct } from "@metamask/superstruct";
2
2
  import type { Describe } from "../internals/index.mjs";
3
3
  import type { GenericSnapElement, Key, SnapElement, SnapsChildren, StringElement } from "./component.mjs";
4
- import { type AddressElement, type BoldElement, type BoxElement, type ButtonElement, type CheckboxElement, type CardElement, type CopyableElement, type DividerElement, type DropdownElement, type OptionElement, type RadioElement, type RadioGroupElement, type FieldElement, type FormElement, type HeadingElement, type ImageElement, type InputElement, type ItalicElement, type JSXElement, type LinkElement, type RowElement, type SpinnerElement, type StandardFormattingElement, type TextElement, type TooltipElement, type ValueElement, type FileInputElement, type ContainerElement, type FooterElement, type IconElement, type SectionElement, type SelectorElement, type SelectorOptionElement } from "./components/index.mjs";
4
+ import { type AddressElement, type BoldElement, type BoxElement, type ButtonElement, type CheckboxElement, type CardElement, type CopyableElement, type DividerElement, type DropdownElement, type OptionElement, type RadioElement, type RadioGroupElement, type FieldElement, type FormElement, type HeadingElement, type ImageElement, type InputElement, type ItalicElement, type JSXElement, type LinkElement, type RowElement, type SpinnerElement, type StandardFormattingElement, type TextElement, type TooltipElement, type ValueElement, type FileInputElement, type ContainerElement, type FooterElement, type IconElement, type SectionElement, type SelectorElement, type SelectorOptionElement, type BannerElement } from "./components/index.mjs";
5
5
  /**
6
6
  * A struct for the {@link Key} type.
7
7
  */
@@ -147,7 +147,7 @@ export declare const FieldChildUnionStruct: Struct<SnapElement<import("./compone
147
147
  }, "RadioGroup"> | SnapElement<import("./components/index.mjs").FileInputProps, "FileInput"> | SnapElement<import("./components/index.mjs").AddressProps, "Address"> | SnapElement<import("./components/index.mjs").CardProps, "Card"> | SnapElement<import("./components/index.mjs").SelectorProps, "Selector"> | SnapElement<import("./components/index.mjs").FieldProps, "Field"> | SnapElement<import("./components/index.mjs").BoldProps, "Bold"> | SnapElement<import("./components/index.mjs").ItalicProps, "Italic"> | SnapElement<import("./components/index.mjs").AvatarProps, "Avatar"> | SnapElement<import("./components/index.mjs").BoxProps, "Box"> | SnapElement<import("./components/index.mjs").CopyableProps, "Copyable"> | SnapElement<Record<string, never>, "Divider"> | SnapElement<{
148
148
  children: StringElement;
149
149
  size?: "md" | "sm" | "lg" | undefined;
150
- }, "Heading"> | SnapElement<import("./components/index.mjs").LinkProps, "Link"> | SnapElement<import("./components/index.mjs").TextProps, "Text"> | SnapElement<import("./components/index.mjs").RowProps, "Row"> | SnapElement<import("./components/index.mjs").SectionProps, "Section"> | SnapElement<Record<string, never>, "Spinner"> | SnapElement<import("./components/index.mjs").TooltipProps, "Tooltip">, null>;
150
+ }, "Heading"> | SnapElement<import("./components/index.mjs").LinkProps, "Link"> | SnapElement<import("./components/index.mjs").TextProps, "Text"> | SnapElement<import("./components/index.mjs").RowProps, "Row"> | SnapElement<import("./components/index.mjs").SectionProps, "Section"> | SnapElement<Record<string, never>, "Spinner"> | SnapElement<import("./components/index.mjs").TooltipProps, "Tooltip"> | SnapElement<import("./components/index.mjs").BannerProps, "Banner">, null>;
151
151
  /**
152
152
  * A struct for the {@link FieldElement} type.
153
153
  */
@@ -232,6 +232,10 @@ export declare const TooltipContentStruct: Struct<string | SnapElement<import(".
232
232
  * A struct for the {@link TooltipElement} type.
233
233
  */
234
234
  export declare const TooltipStruct: Describe<TooltipElement>;
235
+ /**
236
+ * A struct for the {@link BannerElement} type.
237
+ */
238
+ export declare const BannerStruct: Describe<BannerElement>;
235
239
  /**
236
240
  * A struct for the {@link RowElement} type.
237
241
  */
@@ -258,7 +262,7 @@ export declare const BoxChildStruct: Struct<SnapElement<import("./components/ind
258
262
  }, "RadioGroup"> | SnapElement<import("./components/index.mjs").FileInputProps, "FileInput"> | SnapElement<import("./components/index.mjs").AddressProps, "Address"> | SnapElement<import("./components/index.mjs").CardProps, "Card"> | SnapElement<import("./components/index.mjs").SelectorProps, "Selector"> | SnapElement<import("./components/index.mjs").FieldProps, "Field"> | SnapElement<import("./components/index.mjs").BoldProps, "Bold"> | SnapElement<import("./components/index.mjs").ItalicProps, "Italic"> | SnapElement<import("./components/index.mjs").AvatarProps, "Avatar"> | SnapElement<import("./components/index.mjs").BoxProps, "Box"> | SnapElement<import("./components/index.mjs").CopyableProps, "Copyable"> | SnapElement<Record<string, never>, "Divider"> | SnapElement<{
259
263
  children: StringElement;
260
264
  size?: "md" | "sm" | "lg" | undefined;
261
- }, "Heading"> | SnapElement<import("./components/index.mjs").LinkProps, "Link"> | SnapElement<import("./components/index.mjs").TextProps, "Text"> | SnapElement<import("./components/index.mjs").RowProps, "Row"> | SnapElement<import("./components/index.mjs").SectionProps, "Section"> | SnapElement<Record<string, never>, "Spinner"> | SnapElement<import("./components/index.mjs").TooltipProps, "Tooltip">, null>;
265
+ }, "Heading"> | SnapElement<import("./components/index.mjs").LinkProps, "Link"> | SnapElement<import("./components/index.mjs").TextProps, "Text"> | SnapElement<import("./components/index.mjs").RowProps, "Row"> | SnapElement<import("./components/index.mjs").SectionProps, "Section"> | SnapElement<Record<string, never>, "Spinner"> | SnapElement<import("./components/index.mjs").TooltipProps, "Tooltip"> | SnapElement<import("./components/index.mjs").BannerProps, "Banner">, null>;
262
266
  /**
263
267
  * A struct for the {@link ContainerElement} type.
264
268
  */
@@ -280,7 +284,7 @@ export declare const RootJSXElementStruct: Struct<SnapElement<import("./componen
280
284
  }, "RadioGroup"> | SnapElement<import("./components/index.mjs").FileInputProps, "FileInput"> | SnapElement<import("./components/index.mjs").AddressProps, "Address"> | SnapElement<import("./components/index.mjs").CardProps, "Card"> | SnapElement<import("./components/index.mjs").SelectorProps, "Selector"> | SnapElement<import("./components/index.mjs").FieldProps, "Field"> | SnapElement<import("./components/index.mjs").BoldProps, "Bold"> | SnapElement<import("./components/index.mjs").ItalicProps, "Italic"> | SnapElement<import("./components/index.mjs").AvatarProps, "Avatar"> | SnapElement<import("./components/index.mjs").BoxProps, "Box"> | SnapElement<import("./components/index.mjs").ContainerProps, "Container"> | SnapElement<import("./components/index.mjs").CopyableProps, "Copyable"> | SnapElement<Record<string, never>, "Divider"> | SnapElement<{
281
285
  children: StringElement;
282
286
  size?: "md" | "sm" | "lg" | undefined;
283
- }, "Heading"> | SnapElement<import("./components/index.mjs").LinkProps, "Link"> | SnapElement<import("./components/index.mjs").TextProps, "Text"> | SnapElement<import("./components/index.mjs").RowProps, "Row"> | SnapElement<import("./components/index.mjs").SectionProps, "Section"> | SnapElement<Record<string, never>, "Spinner"> | SnapElement<import("./components/index.mjs").TooltipProps, "Tooltip">, null>;
287
+ }, "Heading"> | SnapElement<import("./components/index.mjs").LinkProps, "Link"> | SnapElement<import("./components/index.mjs").TextProps, "Text"> | SnapElement<import("./components/index.mjs").RowProps, "Row"> | SnapElement<import("./components/index.mjs").SectionProps, "Section"> | SnapElement<Record<string, never>, "Spinner"> | SnapElement<import("./components/index.mjs").TooltipProps, "Tooltip"> | SnapElement<import("./components/index.mjs").BannerProps, "Banner">, null>;
284
288
  /**
285
289
  * A struct for the {@link JSXElement} type.
286
290
  */
@@ -1 +1 @@
1
- {"version":3,"file":"validation.d.mts","sourceRoot":"","sources":["../../src/jsx/validation.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAKV,MAAM,EACP,8BAA8B;AAwB/B,OAAO,KAAK,EAAE,QAAQ,EAAE,+BAAqB;AAS7C,OAAO,KAAK,EAEV,kBAAkB,EAElB,GAAG,EAEH,WAAW,EACX,aAAa,EACb,aAAa,EACd,wBAAoB;AAErB,OAAO,EACL,KAA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B,CAAC;AAEH;;GAEG;AACH,eAAO,MAAM,eAAe,EAAE,QAAQ,CAAC,gBAAgB,CAatD,CAAC;AAEF;;;GAGG;AACH,eAAO,MAAM,oBAAoB;;;;;;;;;;;;;kaAG/B,CAAC;AAEH;;GAEG;AACH,eAAO,MAAM,gBAAgB,EAAE,QAAQ,CAAC,UAAU,CAkChD,CAAC;AAEH;;;;;GAKG;AACH,wBAAgB,YAAY,CAAC,KAAK,EAAE,OAAO,GAAG,KAAK,IAAI,UAAU,CAEhE;AAED;;;;;;;;;;GAUG;AACH,wBAAgB,kBAAkB,CAAC,KAAK,EAAE,OAAO,GAAG,KAAK,IAAI,UAAU,CAOtE;AAED;;;;;GAKG;AACH,wBAAgB,gBAAgB,CAAC,KAAK,EAAE,OAAO,GAAG,OAAO,CAAC,KAAK,IAAI,UAAU,CAW5E"}
@@ -1,4 +1,4 @@
1
- import { is, boolean, optional, array, lazy, nullable, number, object, record, string, tuple, refine, assign } from "@metamask/superstruct";
1
+ import { is, boolean, optional, array, lazy, nullable, number, object, record, string, tuple, refine, assign, union } from "@metamask/superstruct";
2
2
  import { CaipAccountIdStruct, hasProperty, HexChecksumAddressStruct, isPlainObject, JsonStruct } from "@metamask/utils";
3
3
  import { literal, nullUnion, selectiveUnion, svg, typedUnion } from "../internals/index.mjs";
4
4
  import { IconName } from "./components/index.mjs";
@@ -120,7 +120,9 @@ export const ButtonStruct = element('Button', {
120
120
  name: optional(string()),
121
121
  type: optional(nullUnion([literal('button'), literal('submit')])),
122
122
  variant: optional(nullUnion([literal('primary'), literal('destructive')])),
123
+ size: optional(nullUnion([literal('sm'), literal('md')])),
123
124
  disabled: optional(boolean()),
125
+ loading: optional(boolean()),
124
126
  form: optional(string()),
125
127
  });
126
128
  /**
@@ -307,12 +309,18 @@ export const FieldChildUnionStruct = nullUnion([
307
309
  /**
308
310
  * A subset of JSX elements that are allowed as children of the Field component.
309
311
  */
310
- const FieldChildStruct = nullUnion([
311
- tuple(BOX_INPUT_LEFT),
312
- tuple(BOX_INPUT_RIGHT),
313
- tuple(BOX_INPUT_BOTH),
314
- ...FIELD_CHILDREN_ARRAY,
315
- ]);
312
+ const FieldChildStruct = selectiveUnion((value) => {
313
+ const isArray = Array.isArray(value);
314
+ if (isArray && value.length === 3) {
315
+ return tuple(BOX_INPUT_BOTH);
316
+ }
317
+ if (isArray && value.length === 2) {
318
+ return value[0]?.type === 'Box'
319
+ ? tuple(BOX_INPUT_LEFT)
320
+ : tuple(BOX_INPUT_RIGHT);
321
+ }
322
+ return typedUnion(FIELD_CHILDREN_ARRAY);
323
+ });
316
324
  /**
317
325
  * A struct for the {@link FieldElement} type.
318
326
  */
@@ -484,6 +492,7 @@ export const TextStruct = element('Text', {
484
492
  literal('warning'),
485
493
  ])),
486
494
  size: optional(nullUnion([literal('sm'), literal('md')])),
495
+ fontWeight: optional(nullUnion([literal('regular'), literal('medium'), literal('bold')])),
487
496
  });
488
497
  /**
489
498
  * A subset of JSX elements that are allowed as children of the Tooltip component.
@@ -525,6 +534,26 @@ export const TooltipStruct = element('Tooltip', {
525
534
  children: nullable(TooltipChildStruct),
526
535
  content: TooltipContentStruct,
527
536
  });
537
+ /**
538
+ * A struct for the {@link BannerElement} type.
539
+ */
540
+ export const BannerStruct = element('Banner', {
541
+ children: children([
542
+ TextStruct,
543
+ LinkStruct,
544
+ IconStruct,
545
+ ButtonStruct,
546
+ BoldStruct,
547
+ ItalicStruct,
548
+ ]),
549
+ title: string(),
550
+ severity: union([
551
+ literal('danger'),
552
+ literal('info'),
553
+ literal('success'),
554
+ literal('warning'),
555
+ ]),
556
+ });
528
557
  /**
529
558
  * A struct for the {@link RowElement} type.
530
559
  */
@@ -576,6 +605,7 @@ export const BoxChildStruct = typedUnion([
576
605
  SelectorStruct,
577
606
  SectionStruct,
578
607
  AvatarStruct,
608
+ BannerStruct,
579
609
  ]);
580
610
  /**
581
611
  * A struct for the {@link ContainerElement} type.
@@ -632,6 +662,7 @@ export const JSXElementStruct = typedUnion([
632
662
  SelectorOptionStruct,
633
663
  SectionStruct,
634
664
  AvatarStruct,
665
+ BannerStruct,
635
666
  ]);
636
667
  /**
637
668
  * Check if a value is a JSX element.