@metamask/snaps-sdk 6.13.0 → 6.15.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 (154) hide show
  1. package/CHANGELOG.md +32 -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/Container.cjs +2 -1
  15. package/dist/jsx/components/Container.cjs.map +1 -1
  16. package/dist/jsx/components/Container.d.cts +7 -1
  17. package/dist/jsx/components/Container.d.cts.map +1 -1
  18. package/dist/jsx/components/Container.d.mts +7 -1
  19. package/dist/jsx/components/Container.d.mts.map +1 -1
  20. package/dist/jsx/components/Container.mjs +2 -1
  21. package/dist/jsx/components/Container.mjs.map +1 -1
  22. package/dist/jsx/components/Text.cjs +5 -0
  23. package/dist/jsx/components/Text.cjs.map +1 -1
  24. package/dist/jsx/components/Text.d.cts +7 -0
  25. package/dist/jsx/components/Text.d.cts.map +1 -1
  26. package/dist/jsx/components/Text.d.mts +7 -0
  27. package/dist/jsx/components/Text.d.mts.map +1 -1
  28. package/dist/jsx/components/Text.mjs +5 -0
  29. package/dist/jsx/components/Text.mjs.map +1 -1
  30. package/dist/jsx/components/Value.cjs +2 -0
  31. package/dist/jsx/components/Value.cjs.map +1 -1
  32. package/dist/jsx/components/Value.d.cts +5 -2
  33. package/dist/jsx/components/Value.d.cts.map +1 -1
  34. package/dist/jsx/components/Value.d.mts +5 -2
  35. package/dist/jsx/components/Value.d.mts.map +1 -1
  36. package/dist/jsx/components/Value.mjs +2 -0
  37. package/dist/jsx/components/Value.mjs.map +1 -1
  38. package/dist/jsx/components/form/Button.cjs.map +1 -1
  39. package/dist/jsx/components/form/Button.d.cts +4 -0
  40. package/dist/jsx/components/form/Button.d.cts.map +1 -1
  41. package/dist/jsx/components/form/Button.d.mts +4 -0
  42. package/dist/jsx/components/form/Button.d.mts.map +1 -1
  43. package/dist/jsx/components/form/Button.mjs.map +1 -1
  44. package/dist/jsx/components/index.cjs +1 -0
  45. package/dist/jsx/components/index.cjs.map +1 -1
  46. package/dist/jsx/components/index.d.cts +3 -1
  47. package/dist/jsx/components/index.d.cts.map +1 -1
  48. package/dist/jsx/components/index.d.mts +3 -1
  49. package/dist/jsx/components/index.d.mts.map +1 -1
  50. package/dist/jsx/components/index.mjs +1 -0
  51. package/dist/jsx/components/index.mjs.map +1 -1
  52. package/dist/jsx/validation.cjs +57 -15
  53. package/dist/jsx/validation.cjs.map +1 -1
  54. package/dist/jsx/validation.d.cts +15 -11
  55. package/dist/jsx/validation.d.cts.map +1 -1
  56. package/dist/jsx/validation.d.mts +15 -11
  57. package/dist/jsx/validation.d.mts.map +1 -1
  58. package/dist/jsx/validation.mjs +56 -14
  59. package/dist/jsx/validation.mjs.map +1 -1
  60. package/dist/types/handlers/index.cjs +1 -0
  61. package/dist/types/handlers/index.cjs.map +1 -1
  62. package/dist/types/handlers/index.d.cts +1 -0
  63. package/dist/types/handlers/index.d.cts.map +1 -1
  64. package/dist/types/handlers/index.d.mts +1 -0
  65. package/dist/types/handlers/index.d.mts.map +1 -1
  66. package/dist/types/handlers/index.mjs +1 -0
  67. package/dist/types/handlers/index.mjs.map +1 -1
  68. package/dist/types/handlers/settings-page.cjs +3 -0
  69. package/dist/types/handlers/settings-page.cjs.map +1 -0
  70. package/dist/types/handlers/settings-page.d.cts +23 -0
  71. package/dist/types/handlers/settings-page.d.cts.map +1 -0
  72. package/dist/types/handlers/settings-page.d.mts +23 -0
  73. package/dist/types/handlers/settings-page.d.mts.map +1 -0
  74. package/dist/types/handlers/settings-page.mjs +2 -0
  75. package/dist/types/handlers/settings-page.mjs.map +1 -0
  76. package/dist/types/interface.d.cts +2 -2
  77. package/dist/types/interface.d.cts.map +1 -1
  78. package/dist/types/interface.d.mts +2 -2
  79. package/dist/types/interface.d.mts.map +1 -1
  80. package/dist/types/methods/cancel-background-event.cjs +3 -0
  81. package/dist/types/methods/cancel-background-event.cjs.map +1 -0
  82. package/dist/types/methods/cancel-background-event.d.cts +15 -0
  83. package/dist/types/methods/cancel-background-event.d.cts.map +1 -0
  84. package/dist/types/methods/cancel-background-event.d.mts +15 -0
  85. package/dist/types/methods/cancel-background-event.d.mts.map +1 -0
  86. package/dist/types/methods/cancel-background-event.mjs +2 -0
  87. package/dist/types/methods/cancel-background-event.mjs.map +1 -0
  88. package/dist/types/methods/clear-state.cjs +3 -0
  89. package/dist/types/methods/clear-state.cjs.map +1 -0
  90. package/dist/types/methods/clear-state.d.cts +16 -0
  91. package/dist/types/methods/clear-state.d.cts.map +1 -0
  92. package/dist/types/methods/clear-state.d.mts +16 -0
  93. package/dist/types/methods/clear-state.d.mts.map +1 -0
  94. package/dist/types/methods/clear-state.mjs +2 -0
  95. package/dist/types/methods/clear-state.mjs.map +1 -0
  96. package/dist/types/methods/get-background-events.cjs +3 -0
  97. package/dist/types/methods/get-background-events.cjs.map +1 -0
  98. package/dist/types/methods/get-background-events.d.cts +38 -0
  99. package/dist/types/methods/get-background-events.d.cts.map +1 -0
  100. package/dist/types/methods/get-background-events.d.mts +38 -0
  101. package/dist/types/methods/get-background-events.d.mts.map +1 -0
  102. package/dist/types/methods/get-background-events.mjs +2 -0
  103. package/dist/types/methods/get-background-events.mjs.map +1 -0
  104. package/dist/types/methods/get-preferences.cjs.map +1 -1
  105. package/dist/types/methods/get-preferences.d.cts +6 -1
  106. package/dist/types/methods/get-preferences.d.cts.map +1 -1
  107. package/dist/types/methods/get-preferences.d.mts +6 -1
  108. package/dist/types/methods/get-preferences.d.mts.map +1 -1
  109. package/dist/types/methods/get-preferences.mjs.map +1 -1
  110. package/dist/types/methods/get-state.cjs +3 -0
  111. package/dist/types/methods/get-state.cjs.map +1 -0
  112. package/dist/types/methods/get-state.d.cts +21 -0
  113. package/dist/types/methods/get-state.d.cts.map +1 -0
  114. package/dist/types/methods/get-state.d.mts +21 -0
  115. package/dist/types/methods/get-state.d.mts.map +1 -0
  116. package/dist/types/methods/get-state.mjs +2 -0
  117. package/dist/types/methods/get-state.mjs.map +1 -0
  118. package/dist/types/methods/index.cjs +8 -2
  119. package/dist/types/methods/index.cjs.map +1 -1
  120. package/dist/types/methods/index.d.cts +8 -2
  121. package/dist/types/methods/index.d.cts.map +1 -1
  122. package/dist/types/methods/index.d.mts +8 -2
  123. package/dist/types/methods/index.d.mts.map +1 -1
  124. package/dist/types/methods/index.mjs +8 -2
  125. package/dist/types/methods/index.mjs.map +1 -1
  126. package/dist/types/methods/methods.cjs.map +1 -1
  127. package/dist/types/methods/methods.d.cts +21 -0
  128. package/dist/types/methods/methods.d.cts.map +1 -1
  129. package/dist/types/methods/methods.d.mts +21 -0
  130. package/dist/types/methods/methods.d.mts.map +1 -1
  131. package/dist/types/methods/methods.mjs.map +1 -1
  132. package/dist/types/methods/schedule-background-event.cjs +3 -0
  133. package/dist/types/methods/schedule-background-event.cjs.map +1 -0
  134. package/dist/types/methods/schedule-background-event.d.cts +22 -0
  135. package/dist/types/methods/schedule-background-event.d.cts.map +1 -0
  136. package/dist/types/methods/schedule-background-event.d.mts +22 -0
  137. package/dist/types/methods/schedule-background-event.d.mts.map +1 -0
  138. package/dist/types/methods/schedule-background-event.mjs +2 -0
  139. package/dist/types/methods/schedule-background-event.mjs.map +1 -0
  140. package/dist/types/methods/set-state.cjs +3 -0
  141. package/dist/types/methods/set-state.cjs.map +1 -0
  142. package/dist/types/methods/set-state.d.cts +23 -0
  143. package/dist/types/methods/set-state.d.cts.map +1 -0
  144. package/dist/types/methods/set-state.d.mts +23 -0
  145. package/dist/types/methods/set-state.d.mts.map +1 -0
  146. package/dist/types/methods/set-state.mjs +2 -0
  147. package/dist/types/methods/set-state.mjs.map +1 -0
  148. package/dist/types/permissions.cjs.map +1 -1
  149. package/dist/types/permissions.d.cts +4 -1
  150. package/dist/types/permissions.d.cts.map +1 -1
  151. package/dist/types/permissions.d.mts +4 -1
  152. package/dist/types/permissions.d.mts.map +1 -1
  153. package/dist/types/permissions.mjs.map +1 -1
  154. package/package.json +5 -5
@@ -1 +1 @@
1
- {"version":3,"file":"Button.cjs","sourceRoot":"","sources":["../../../../src/jsx/components/form/Button.ts"],"names":[],"mappings":";;;AACA,mDAAsD;AA4BtD,MAAM,IAAI,GAAG,QAAQ,CAAC;AAEtB;;;;;;;;;GASG;AACU,QAAA,MAAM,GAAG,IAAA,+BAAmB,EAA2B,IAAI,CAAC,CAAC","sourcesContent":["import type { SnapsChildren, StringElement } from '../../component';\nimport { createSnapComponent } from '../../component';\nimport type { IconElement } from '../Icon';\nimport type { ImageElement } from '../Image';\n\n// TODO: Add the `onClick` prop to the `ButtonProps` type.\n\n/**\n * The props of the {@link Button} component.\n *\n * @property children - The text to display on the button.\n * @property name - The name of the button. This is used to identify the button\n * in the event handler.\n * @property type - The type of the button, i.e., `'button'` or `'submit'`.\n * Defaults to `'button'`.\n * @property variant - The variant of the button, i.e., `'primary'` or\n * `'destructive'`. Defaults to `'primary'`.\n * @property disabled - Whether the button is disabled. Defaults to `false`.\n * @property form - The name of the form component to associate the button with.\n */\nexport type ButtonProps = {\n children: SnapsChildren<StringElement | IconElement | ImageElement>;\n name?: string | undefined;\n type?: 'button' | 'submit' | undefined;\n variant?: 'primary' | 'destructive' | undefined;\n disabled?: boolean | undefined;\n form?: string | undefined;\n};\n\nconst TYPE = 'Button';\n\n/**\n * A button component, which is used to create a clickable button.\n *\n * @param props - The props of the component.\n * @param props.children - The text to display on the button. This should be a\n * string or an array of strings.\n * @returns A button element.\n * @example\n * <Button name=\"my-button\">Click me</Button>\n */\nexport const Button = createSnapComponent<ButtonProps, typeof TYPE>(TYPE);\n\n/**\n * A button element.\n *\n * @see Button\n */\nexport type ButtonElement = ReturnType<typeof Button>;\n"]}
1
+ {"version":3,"file":"Button.cjs","sourceRoot":"","sources":["../../../../src/jsx/components/form/Button.ts"],"names":[],"mappings":";;;AACA,mDAAsD;AAgCtD,MAAM,IAAI,GAAG,QAAQ,CAAC;AAEtB;;;;;;;;;GASG;AACU,QAAA,MAAM,GAAG,IAAA,+BAAmB,EAA2B,IAAI,CAAC,CAAC","sourcesContent":["import type { SnapsChildren, StringElement } from '../../component';\nimport { createSnapComponent } from '../../component';\nimport type { IconElement } from '../Icon';\nimport type { ImageElement } from '../Image';\n\n// TODO: Add the `onClick` prop to the `ButtonProps` type.\n\n/**\n * The props of the {@link Button} component.\n *\n * @property children - The text to display on the button.\n * @property name - The name of the button. This is used to identify the button\n * in the event handler.\n * @property type - The type of the button, i.e., `'button'` or `'submit'`.\n * Defaults to `'button'`.\n * @property variant - The variant of the button, i.e., `'primary'` or\n * `'destructive'`. Defaults to `'primary'`.\n * @property size - The size of the button. Defaults to `md`.\n * @property disabled - Whether the button is disabled. Defaults to `false`.\n * @property loading - Whether the button is loading. Defaults to `false`.\n * @property form - The name of the form component to associate the button with.\n */\nexport type ButtonProps = {\n children: SnapsChildren<StringElement | IconElement | ImageElement>;\n name?: string | undefined;\n type?: 'button' | 'submit' | undefined;\n variant?: 'primary' | 'destructive' | undefined;\n size?: 'sm' | 'md' | undefined;\n disabled?: boolean | undefined;\n loading?: boolean | undefined;\n form?: string | undefined;\n};\n\nconst TYPE = 'Button';\n\n/**\n * A button component, which is used to create a clickable button.\n *\n * @param props - The props of the component.\n * @param props.children - The text to display on the button. This should be a\n * string or an array of strings.\n * @returns A button element.\n * @example\n * <Button name=\"my-button\">Click me</Button>\n */\nexport const Button = createSnapComponent<ButtonProps, typeof TYPE>(TYPE);\n\n/**\n * A button element.\n *\n * @see Button\n */\nexport type ButtonElement = ReturnType<typeof Button>;\n"]}
@@ -11,7 +11,9 @@ import type { ImageElement } from "../Image.cjs";
11
11
  * Defaults to `'button'`.
12
12
  * @property variant - The variant of the button, i.e., `'primary'` or
13
13
  * `'destructive'`. Defaults to `'primary'`.
14
+ * @property size - The size of the button. Defaults to `md`.
14
15
  * @property disabled - Whether the button is disabled. Defaults to `false`.
16
+ * @property loading - Whether the button is loading. Defaults to `false`.
15
17
  * @property form - The name of the form component to associate the button with.
16
18
  */
17
19
  export type ButtonProps = {
@@ -19,7 +21,9 @@ export type ButtonProps = {
19
21
  name?: string | undefined;
20
22
  type?: 'button' | 'submit' | undefined;
21
23
  variant?: 'primary' | 'destructive' | undefined;
24
+ size?: 'sm' | 'md' | undefined;
22
25
  disabled?: boolean | undefined;
26
+ loading?: boolean | undefined;
23
27
  form?: string | undefined;
24
28
  };
25
29
  /**
@@ -1 +1 @@
1
- {"version":3,"file":"Button.d.cts","sourceRoot":"","sources":["../../../../src/jsx/components/form/Button.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,aAAa,EAAE,aAAa,EAAE,4BAAwB;AAEpE,OAAO,KAAK,EAAE,WAAW,EAAE,oBAAgB;AAC3C,OAAO,KAAK,EAAE,YAAY,EAAE,qBAAiB;AAI7C;;;;;;;;;;;;GAYG;AACH,MAAM,MAAM,WAAW,GAAG;IACxB,QAAQ,EAAE,aAAa,CAAC,aAAa,GAAG,WAAW,GAAG,YAAY,CAAC,CAAC;IACpE,IAAI,CAAC,EAAE,MAAM,GAAG,SAAS,CAAC;IAC1B,IAAI,CAAC,EAAE,QAAQ,GAAG,QAAQ,GAAG,SAAS,CAAC;IACvC,OAAO,CAAC,EAAE,SAAS,GAAG,aAAa,GAAG,SAAS,CAAC;IAChD,QAAQ,CAAC,EAAE,OAAO,GAAG,SAAS,CAAC;IAC/B,IAAI,CAAC,EAAE,MAAM,GAAG,SAAS,CAAC;CAC3B,CAAC;AAIF;;;;;;;;;GASG;AACH,eAAO,MAAM,MAAM,gEAAsD,CAAC;AAE1E;;;;GAIG;AACH,MAAM,MAAM,aAAa,GAAG,UAAU,CAAC,OAAO,MAAM,CAAC,CAAC"}
1
+ {"version":3,"file":"Button.d.cts","sourceRoot":"","sources":["../../../../src/jsx/components/form/Button.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,aAAa,EAAE,aAAa,EAAE,4BAAwB;AAEpE,OAAO,KAAK,EAAE,WAAW,EAAE,oBAAgB;AAC3C,OAAO,KAAK,EAAE,YAAY,EAAE,qBAAiB;AAI7C;;;;;;;;;;;;;;GAcG;AACH,MAAM,MAAM,WAAW,GAAG;IACxB,QAAQ,EAAE,aAAa,CAAC,aAAa,GAAG,WAAW,GAAG,YAAY,CAAC,CAAC;IACpE,IAAI,CAAC,EAAE,MAAM,GAAG,SAAS,CAAC;IAC1B,IAAI,CAAC,EAAE,QAAQ,GAAG,QAAQ,GAAG,SAAS,CAAC;IACvC,OAAO,CAAC,EAAE,SAAS,GAAG,aAAa,GAAG,SAAS,CAAC;IAChD,IAAI,CAAC,EAAE,IAAI,GAAG,IAAI,GAAG,SAAS,CAAC;IAC/B,QAAQ,CAAC,EAAE,OAAO,GAAG,SAAS,CAAC;IAC/B,OAAO,CAAC,EAAE,OAAO,GAAG,SAAS,CAAC;IAC9B,IAAI,CAAC,EAAE,MAAM,GAAG,SAAS,CAAC;CAC3B,CAAC;AAIF;;;;;;;;;GASG;AACH,eAAO,MAAM,MAAM,gEAAsD,CAAC;AAE1E;;;;GAIG;AACH,MAAM,MAAM,aAAa,GAAG,UAAU,CAAC,OAAO,MAAM,CAAC,CAAC"}
@@ -11,7 +11,9 @@ import type { ImageElement } from "../Image.mjs";
11
11
  * Defaults to `'button'`.
12
12
  * @property variant - The variant of the button, i.e., `'primary'` or
13
13
  * `'destructive'`. Defaults to `'primary'`.
14
+ * @property size - The size of the button. Defaults to `md`.
14
15
  * @property disabled - Whether the button is disabled. Defaults to `false`.
16
+ * @property loading - Whether the button is loading. Defaults to `false`.
15
17
  * @property form - The name of the form component to associate the button with.
16
18
  */
17
19
  export type ButtonProps = {
@@ -19,7 +21,9 @@ export type ButtonProps = {
19
21
  name?: string | undefined;
20
22
  type?: 'button' | 'submit' | undefined;
21
23
  variant?: 'primary' | 'destructive' | undefined;
24
+ size?: 'sm' | 'md' | undefined;
22
25
  disabled?: boolean | undefined;
26
+ loading?: boolean | undefined;
23
27
  form?: string | undefined;
24
28
  };
25
29
  /**
@@ -1 +1 @@
1
- {"version":3,"file":"Button.d.mts","sourceRoot":"","sources":["../../../../src/jsx/components/form/Button.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,aAAa,EAAE,aAAa,EAAE,4BAAwB;AAEpE,OAAO,KAAK,EAAE,WAAW,EAAE,oBAAgB;AAC3C,OAAO,KAAK,EAAE,YAAY,EAAE,qBAAiB;AAI7C;;;;;;;;;;;;GAYG;AACH,MAAM,MAAM,WAAW,GAAG;IACxB,QAAQ,EAAE,aAAa,CAAC,aAAa,GAAG,WAAW,GAAG,YAAY,CAAC,CAAC;IACpE,IAAI,CAAC,EAAE,MAAM,GAAG,SAAS,CAAC;IAC1B,IAAI,CAAC,EAAE,QAAQ,GAAG,QAAQ,GAAG,SAAS,CAAC;IACvC,OAAO,CAAC,EAAE,SAAS,GAAG,aAAa,GAAG,SAAS,CAAC;IAChD,QAAQ,CAAC,EAAE,OAAO,GAAG,SAAS,CAAC;IAC/B,IAAI,CAAC,EAAE,MAAM,GAAG,SAAS,CAAC;CAC3B,CAAC;AAIF;;;;;;;;;GASG;AACH,eAAO,MAAM,MAAM,gEAAsD,CAAC;AAE1E;;;;GAIG;AACH,MAAM,MAAM,aAAa,GAAG,UAAU,CAAC,OAAO,MAAM,CAAC,CAAC"}
1
+ {"version":3,"file":"Button.d.mts","sourceRoot":"","sources":["../../../../src/jsx/components/form/Button.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,aAAa,EAAE,aAAa,EAAE,4BAAwB;AAEpE,OAAO,KAAK,EAAE,WAAW,EAAE,oBAAgB;AAC3C,OAAO,KAAK,EAAE,YAAY,EAAE,qBAAiB;AAI7C;;;;;;;;;;;;;;GAcG;AACH,MAAM,MAAM,WAAW,GAAG;IACxB,QAAQ,EAAE,aAAa,CAAC,aAAa,GAAG,WAAW,GAAG,YAAY,CAAC,CAAC;IACpE,IAAI,CAAC,EAAE,MAAM,GAAG,SAAS,CAAC;IAC1B,IAAI,CAAC,EAAE,QAAQ,GAAG,QAAQ,GAAG,SAAS,CAAC;IACvC,OAAO,CAAC,EAAE,SAAS,GAAG,aAAa,GAAG,SAAS,CAAC;IAChD,IAAI,CAAC,EAAE,IAAI,GAAG,IAAI,GAAG,SAAS,CAAC;IAC/B,QAAQ,CAAC,EAAE,OAAO,GAAG,SAAS,CAAC;IAC/B,OAAO,CAAC,EAAE,OAAO,GAAG,SAAS,CAAC;IAC9B,IAAI,CAAC,EAAE,MAAM,GAAG,SAAS,CAAC;CAC3B,CAAC;AAIF;;;;;;;;;GASG;AACH,eAAO,MAAM,MAAM,gEAAsD,CAAC;AAE1E;;;;GAIG;AACH,MAAM,MAAM,aAAa,GAAG,UAAU,CAAC,OAAO,MAAM,CAAC,CAAC"}
@@ -1 +1 @@
1
- {"version":3,"file":"Button.mjs","sourceRoot":"","sources":["../../../../src/jsx/components/form/Button.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,mBAAmB,EAAE,4BAAwB;AA4BtD,MAAM,IAAI,GAAG,QAAQ,CAAC;AAEtB;;;;;;;;;GASG;AACH,MAAM,CAAC,MAAM,MAAM,GAAG,mBAAmB,CAA2B,IAAI,CAAC,CAAC","sourcesContent":["import type { SnapsChildren, StringElement } from '../../component';\nimport { createSnapComponent } from '../../component';\nimport type { IconElement } from '../Icon';\nimport type { ImageElement } from '../Image';\n\n// TODO: Add the `onClick` prop to the `ButtonProps` type.\n\n/**\n * The props of the {@link Button} component.\n *\n * @property children - The text to display on the button.\n * @property name - The name of the button. This is used to identify the button\n * in the event handler.\n * @property type - The type of the button, i.e., `'button'` or `'submit'`.\n * Defaults to `'button'`.\n * @property variant - The variant of the button, i.e., `'primary'` or\n * `'destructive'`. Defaults to `'primary'`.\n * @property disabled - Whether the button is disabled. Defaults to `false`.\n * @property form - The name of the form component to associate the button with.\n */\nexport type ButtonProps = {\n children: SnapsChildren<StringElement | IconElement | ImageElement>;\n name?: string | undefined;\n type?: 'button' | 'submit' | undefined;\n variant?: 'primary' | 'destructive' | undefined;\n disabled?: boolean | undefined;\n form?: string | undefined;\n};\n\nconst TYPE = 'Button';\n\n/**\n * A button component, which is used to create a clickable button.\n *\n * @param props - The props of the component.\n * @param props.children - The text to display on the button. This should be a\n * string or an array of strings.\n * @returns A button element.\n * @example\n * <Button name=\"my-button\">Click me</Button>\n */\nexport const Button = createSnapComponent<ButtonProps, typeof TYPE>(TYPE);\n\n/**\n * A button element.\n *\n * @see Button\n */\nexport type ButtonElement = ReturnType<typeof Button>;\n"]}
1
+ {"version":3,"file":"Button.mjs","sourceRoot":"","sources":["../../../../src/jsx/components/form/Button.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,mBAAmB,EAAE,4BAAwB;AAgCtD,MAAM,IAAI,GAAG,QAAQ,CAAC;AAEtB;;;;;;;;;GASG;AACH,MAAM,CAAC,MAAM,MAAM,GAAG,mBAAmB,CAA2B,IAAI,CAAC,CAAC","sourcesContent":["import type { SnapsChildren, StringElement } from '../../component';\nimport { createSnapComponent } from '../../component';\nimport type { IconElement } from '../Icon';\nimport type { ImageElement } from '../Image';\n\n// TODO: Add the `onClick` prop to the `ButtonProps` type.\n\n/**\n * The props of the {@link Button} component.\n *\n * @property children - The text to display on the button.\n * @property name - The name of the button. This is used to identify the button\n * in the event handler.\n * @property type - The type of the button, i.e., `'button'` or `'submit'`.\n * Defaults to `'button'`.\n * @property variant - The variant of the button, i.e., `'primary'` or\n * `'destructive'`. Defaults to `'primary'`.\n * @property size - The size of the button. Defaults to `md`.\n * @property disabled - Whether the button is disabled. Defaults to `false`.\n * @property loading - Whether the button is loading. Defaults to `false`.\n * @property form - The name of the form component to associate the button with.\n */\nexport type ButtonProps = {\n children: SnapsChildren<StringElement | IconElement | ImageElement>;\n name?: string | undefined;\n type?: 'button' | 'submit' | undefined;\n variant?: 'primary' | 'destructive' | undefined;\n size?: 'sm' | 'md' | undefined;\n disabled?: boolean | undefined;\n loading?: boolean | undefined;\n form?: string | undefined;\n};\n\nconst TYPE = 'Button';\n\n/**\n * A button component, which is used to create a clickable button.\n *\n * @param props - The props of the component.\n * @param props.children - The text to display on the button. This should be a\n * string or an array of strings.\n * @returns A button element.\n * @example\n * <Button name=\"my-button\">Click me</Button>\n */\nexport const Button = createSnapComponent<ButtonProps, typeof TYPE>(TYPE);\n\n/**\n * A button element.\n *\n * @see Button\n */\nexport type ButtonElement = ReturnType<typeof Button>;\n"]}
@@ -34,4 +34,5 @@ __exportStar(require("./Tooltip.cjs"), exports);
34
34
  __exportStar(require("./Footer.cjs"), exports);
35
35
  __exportStar(require("./Container.cjs"), exports);
36
36
  __exportStar(require("./Section.cjs"), exports);
37
+ __exportStar(require("./Banner.cjs"), exports);
37
38
  //# sourceMappingURL=index.cjs.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.cjs","sourceRoot":"","sources":["../../../src/jsx/components/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAqBA,mDAAuB;AACvB,yDAA6B;AAC7B,gDAA0B;AAC1B,+CAAyB;AACzB,4CAAsB;AACtB,6CAAuB;AACvB,iDAA2B;AAC3B,gDAA0B;AAC1B,8CAAwB;AACxB,gDAA0B;AAC1B,6CAAuB;AACvB,8CAAwB;AACxB,6CAAuB;AACvB,4CAAsB;AACtB,gDAA0B;AAC1B,6CAAuB;AACvB,gDAA0B;AAC1B,+CAAyB;AACzB,kDAA4B;AAC5B,gDAA0B","sourcesContent":["import type { AddressElement } from './Address';\nimport type { AvatarElement } from './Avatar';\nimport type { BoxElement } from './Box';\nimport type { CardElement } from './Card';\nimport type { ContainerElement } from './Container';\nimport type { CopyableElement } from './Copyable';\nimport type { DividerElement } from './Divider';\nimport type { FooterElement } from './Footer';\nimport type { StandardFormElement } from './form';\nimport type { StandardFormattingElement } from './formatting';\nimport type { HeadingElement } from './Heading';\nimport type { IconElement } from './Icon';\nimport type { ImageElement } from './Image';\nimport type { LinkElement } from './Link';\nimport type { RowElement } from './Row';\nimport type { SectionElement } from './Section';\nimport type { SpinnerElement } from './Spinner';\nimport type { TextElement } from './Text';\nimport type { TooltipElement } from './Tooltip';\nimport type { ValueElement } from './Value';\n\nexport * from './form';\nexport * from './formatting';\nexport * from './Address';\nexport * from './Avatar';\nexport * from './Box';\nexport * from './Card';\nexport * from './Copyable';\nexport * from './Divider';\nexport * from './Value';\nexport * from './Heading';\nexport * from './Icon';\nexport * from './Image';\nexport * from './Link';\nexport * from './Row';\nexport * from './Spinner';\nexport * from './Text';\nexport * from './Tooltip';\nexport * from './Footer';\nexport * from './Container';\nexport * from './Section';\n\n/**\n * A built-in JSX element, which can be used in a Snap user interface.\n */\nexport type JSXElement =\n | StandardFormElement\n | StandardFormattingElement\n | AvatarElement\n | AddressElement\n | BoxElement\n | CardElement\n | ContainerElement\n | CopyableElement\n | DividerElement\n | FooterElement\n | ValueElement\n | HeadingElement\n | IconElement\n | ImageElement\n | LinkElement\n | RowElement\n | SectionElement\n | SpinnerElement\n | TextElement\n | TooltipElement;\n"]}
1
+ {"version":3,"file":"index.cjs","sourceRoot":"","sources":["../../../src/jsx/components/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAsBA,mDAAuB;AACvB,yDAA6B;AAC7B,gDAA0B;AAC1B,+CAAyB;AACzB,4CAAsB;AACtB,6CAAuB;AACvB,iDAA2B;AAC3B,gDAA0B;AAC1B,8CAAwB;AACxB,gDAA0B;AAC1B,6CAAuB;AACvB,8CAAwB;AACxB,6CAAuB;AACvB,4CAAsB;AACtB,gDAA0B;AAC1B,6CAAuB;AACvB,gDAA0B;AAC1B,+CAAyB;AACzB,kDAA4B;AAC5B,gDAA0B;AAC1B,+CAAyB","sourcesContent":["import type { AddressElement } from './Address';\nimport type { AvatarElement } from './Avatar';\nimport type { BannerElement } from './Banner';\nimport type { BoxElement } from './Box';\nimport type { CardElement } from './Card';\nimport type { ContainerElement } from './Container';\nimport type { CopyableElement } from './Copyable';\nimport type { DividerElement } from './Divider';\nimport type { FooterElement } from './Footer';\nimport type { StandardFormElement } from './form';\nimport type { StandardFormattingElement } from './formatting';\nimport type { HeadingElement } from './Heading';\nimport type { IconElement } from './Icon';\nimport type { ImageElement } from './Image';\nimport type { LinkElement } from './Link';\nimport type { RowElement } from './Row';\nimport type { SectionElement } from './Section';\nimport type { SpinnerElement } from './Spinner';\nimport type { TextElement } from './Text';\nimport type { TooltipElement } from './Tooltip';\nimport type { ValueElement } from './Value';\n\nexport * from './form';\nexport * from './formatting';\nexport * from './Address';\nexport * from './Avatar';\nexport * from './Box';\nexport * from './Card';\nexport * from './Copyable';\nexport * from './Divider';\nexport * from './Value';\nexport * from './Heading';\nexport * from './Icon';\nexport * from './Image';\nexport * from './Link';\nexport * from './Row';\nexport * from './Spinner';\nexport * from './Text';\nexport * from './Tooltip';\nexport * from './Footer';\nexport * from './Container';\nexport * from './Section';\nexport * from './Banner';\n\n/**\n * A built-in JSX element, which can be used in a Snap user interface.\n */\nexport type JSXElement =\n | StandardFormElement\n | StandardFormattingElement\n | AvatarElement\n | AddressElement\n | BoxElement\n | CardElement\n | ContainerElement\n | CopyableElement\n | DividerElement\n | FooterElement\n | ValueElement\n | HeadingElement\n | IconElement\n | ImageElement\n | LinkElement\n | RowElement\n | SectionElement\n | SpinnerElement\n | TextElement\n | TooltipElement\n | BannerElement;\n"]}
@@ -1,5 +1,6 @@
1
1
  import type { AddressElement } from "./Address.cjs";
2
2
  import type { AvatarElement } from "./Avatar.cjs";
3
+ import type { BannerElement } from "./Banner.cjs";
3
4
  import type { BoxElement } from "./Box.cjs";
4
5
  import type { CardElement } from "./Card.cjs";
5
6
  import type { ContainerElement } from "./Container.cjs";
@@ -38,8 +39,9 @@ export * from "./Tooltip.cjs";
38
39
  export * from "./Footer.cjs";
39
40
  export * from "./Container.cjs";
40
41
  export * from "./Section.cjs";
42
+ export * from "./Banner.cjs";
41
43
  /**
42
44
  * A built-in JSX element, which can be used in a Snap user interface.
43
45
  */
44
- export type JSXElement = StandardFormElement | StandardFormattingElement | AvatarElement | AddressElement | BoxElement | CardElement | ContainerElement | CopyableElement | DividerElement | FooterElement | ValueElement | HeadingElement | IconElement | ImageElement | LinkElement | RowElement | SectionElement | SpinnerElement | TextElement | TooltipElement;
46
+ export type JSXElement = StandardFormElement | StandardFormattingElement | AvatarElement | AddressElement | BoxElement | CardElement | ContainerElement | CopyableElement | DividerElement | FooterElement | ValueElement | HeadingElement | IconElement | ImageElement | LinkElement | RowElement | SectionElement | SpinnerElement | TextElement | TooltipElement | BannerElement;
45
47
  //# sourceMappingURL=index.d.cts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.cts","sourceRoot":"","sources":["../../../src/jsx/components/index.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,cAAc,EAAE,sBAAkB;AAChD,OAAO,KAAK,EAAE,aAAa,EAAE,qBAAiB;AAC9C,OAAO,KAAK,EAAE,UAAU,EAAE,kBAAc;AACxC,OAAO,KAAK,EAAE,WAAW,EAAE,mBAAe;AAC1C,OAAO,KAAK,EAAE,gBAAgB,EAAE,wBAAoB;AACpD,OAAO,KAAK,EAAE,eAAe,EAAE,uBAAmB;AAClD,OAAO,KAAK,EAAE,cAAc,EAAE,sBAAkB;AAChD,OAAO,KAAK,EAAE,aAAa,EAAE,qBAAiB;AAC9C,OAAO,KAAK,EAAE,mBAAmB,EAAE,yBAAe;AAClD,OAAO,KAAK,EAAE,yBAAyB,EAAE,+BAAqB;AAC9D,OAAO,KAAK,EAAE,cAAc,EAAE,sBAAkB;AAChD,OAAO,KAAK,EAAE,WAAW,EAAE,mBAAe;AAC1C,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ACZ,WAAW,GACX,UAAU,GACV,cAAc,GACd,cAAc,GACd,WAAW,GACX,cAAc,GACd,aAAa,CAAC"}
@@ -1,5 +1,6 @@
1
1
  import type { AddressElement } from "./Address.mjs";
2
2
  import type { AvatarElement } from "./Avatar.mjs";
3
+ import type { BannerElement } from "./Banner.mjs";
3
4
  import type { BoxElement } from "./Box.mjs";
4
5
  import type { CardElement } from "./Card.mjs";
5
6
  import type { ContainerElement } from "./Container.mjs";
@@ -38,8 +39,9 @@ export * from "./Tooltip.mjs";
38
39
  export * from "./Footer.mjs";
39
40
  export * from "./Container.mjs";
40
41
  export * from "./Section.mjs";
42
+ export * from "./Banner.mjs";
41
43
  /**
42
44
  * A built-in JSX element, which can be used in a Snap user interface.
43
45
  */
44
- export type JSXElement = StandardFormElement | StandardFormattingElement | AvatarElement | AddressElement | BoxElement | CardElement | ContainerElement | CopyableElement | DividerElement | FooterElement | ValueElement | HeadingElement | IconElement | ImageElement | LinkElement | RowElement | SectionElement | SpinnerElement | TextElement | TooltipElement;
46
+ export type JSXElement = StandardFormElement | StandardFormattingElement | AvatarElement | AddressElement | BoxElement | CardElement | ContainerElement | CopyableElement | DividerElement | FooterElement | ValueElement | HeadingElement | IconElement | ImageElement | LinkElement | RowElement | SectionElement | SpinnerElement | TextElement | TooltipElement | BannerElement;
45
47
  //# sourceMappingURL=index.d.mts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.mts","sourceRoot":"","sources":["../../../src/jsx/components/index.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,cAAc,EAAE,sBAAkB;AAChD,OAAO,KAAK,EAAE,aAAa,EAAE,qBAAiB;AAC9C,OAAO,KAAK,EAAE,UAAU,EAAE,kBAAc;AACxC,OAAO,KAAK,EAAE,WAAW,EAAE,mBAAe;AAC1C,OAAO,KAAK,EAAE,gBAAgB,EAAE,wBAAoB;AACpD,OAAO,KAAK,EAAE,eAAe,EAAE,uBAAmB;AAClD,OAAO,KAAK,EAAE,cAAc,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AACzB,gCAA4B;AAC5B,8BAA0B;AAC1B,6BAAyB;AAEzB;;GAEG;AACH,MAAM,MAAM,UAAU,GAClB,mBAAmB,GACnB,yBAAyB,GACzB,aAAa,GACb,cAAc,GACd,UAAU,GACV,WAAW,GACX,gBAAgB,GAChB,eAAe,GACf,cAAc,GACd,aAAa,GACb,YAAY,GACZ,cAAc,GACd,WAAW,GACX,YAAY,GACZ,WAAW,GACX,UAAU,GACV,cAAc,GACd,cAAc,GACd,WAAW,GACX,cAAc,GACd,aAAa,CAAC"}
@@ -18,4 +18,5 @@ export * from "./Tooltip.mjs";
18
18
  export * from "./Footer.mjs";
19
19
  export * from "./Container.mjs";
20
20
  export * from "./Section.mjs";
21
+ export * from "./Banner.mjs";
21
22
  //# sourceMappingURL=index.mjs.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.mjs","sourceRoot":"","sources":["../../../src/jsx/components/index.ts"],"names":[],"mappings":"AAqBA,iCAAuB;AACvB,uCAA6B;AAC7B,8BAA0B;AAC1B,6BAAyB;AACzB,0BAAsB;AACtB,2BAAuB;AACvB,+BAA2B;AAC3B,8BAA0B;AAC1B,4BAAwB;AACxB,8BAA0B;AAC1B,2BAAuB;AACvB,4BAAwB;AACxB,2BAAuB;AACvB,0BAAsB;AACtB,8BAA0B;AAC1B,2BAAuB;AACvB,8BAA0B;AAC1B,6BAAyB;AACzB,gCAA4B;AAC5B,8BAA0B","sourcesContent":["import type { AddressElement } from './Address';\nimport type { AvatarElement } from './Avatar';\nimport type { BoxElement } from './Box';\nimport type { CardElement } from './Card';\nimport type { ContainerElement } from './Container';\nimport type { CopyableElement } from './Copyable';\nimport type { DividerElement } from './Divider';\nimport type { FooterElement } from './Footer';\nimport type { StandardFormElement } from './form';\nimport type { StandardFormattingElement } from './formatting';\nimport type { HeadingElement } from './Heading';\nimport type { IconElement } from './Icon';\nimport type { ImageElement } from './Image';\nimport type { LinkElement } from './Link';\nimport type { RowElement } from './Row';\nimport type { SectionElement } from './Section';\nimport type { SpinnerElement } from './Spinner';\nimport type { TextElement } from './Text';\nimport type { TooltipElement } from './Tooltip';\nimport type { ValueElement } from './Value';\n\nexport * from './form';\nexport * from './formatting';\nexport * from './Address';\nexport * from './Avatar';\nexport * from './Box';\nexport * from './Card';\nexport * from './Copyable';\nexport * from './Divider';\nexport * from './Value';\nexport * from './Heading';\nexport * from './Icon';\nexport * from './Image';\nexport * from './Link';\nexport * from './Row';\nexport * from './Spinner';\nexport * from './Text';\nexport * from './Tooltip';\nexport * from './Footer';\nexport * from './Container';\nexport * from './Section';\n\n/**\n * A built-in JSX element, which can be used in a Snap user interface.\n */\nexport type JSXElement =\n | StandardFormElement\n | StandardFormattingElement\n | AvatarElement\n | AddressElement\n | BoxElement\n | CardElement\n | ContainerElement\n | CopyableElement\n | DividerElement\n | FooterElement\n | ValueElement\n | HeadingElement\n | IconElement\n | ImageElement\n | LinkElement\n | RowElement\n | SectionElement\n | SpinnerElement\n | TextElement\n | TooltipElement;\n"]}
1
+ {"version":3,"file":"index.mjs","sourceRoot":"","sources":["../../../src/jsx/components/index.ts"],"names":[],"mappings":"AAsBA,iCAAuB;AACvB,uCAA6B;AAC7B,8BAA0B;AAC1B,6BAAyB;AACzB,0BAAsB;AACtB,2BAAuB;AACvB,+BAA2B;AAC3B,8BAA0B;AAC1B,4BAAwB;AACxB,8BAA0B;AAC1B,2BAAuB;AACvB,4BAAwB;AACxB,2BAAuB;AACvB,0BAAsB;AACtB,8BAA0B;AAC1B,2BAAuB;AACvB,8BAA0B;AAC1B,6BAAyB;AACzB,gCAA4B;AAC5B,8BAA0B;AAC1B,6BAAyB","sourcesContent":["import type { AddressElement } from './Address';\nimport type { AvatarElement } from './Avatar';\nimport type { BannerElement } from './Banner';\nimport type { BoxElement } from './Box';\nimport type { CardElement } from './Card';\nimport type { ContainerElement } from './Container';\nimport type { CopyableElement } from './Copyable';\nimport type { DividerElement } from './Divider';\nimport type { FooterElement } from './Footer';\nimport type { StandardFormElement } from './form';\nimport type { StandardFormattingElement } from './formatting';\nimport type { HeadingElement } from './Heading';\nimport type { IconElement } from './Icon';\nimport type { ImageElement } from './Image';\nimport type { LinkElement } from './Link';\nimport type { RowElement } from './Row';\nimport type { SectionElement } from './Section';\nimport type { SpinnerElement } from './Spinner';\nimport type { TextElement } from './Text';\nimport type { TooltipElement } from './Tooltip';\nimport type { ValueElement } from './Value';\n\nexport * from './form';\nexport * from './formatting';\nexport * from './Address';\nexport * from './Avatar';\nexport * from './Box';\nexport * from './Card';\nexport * from './Copyable';\nexport * from './Divider';\nexport * from './Value';\nexport * from './Heading';\nexport * from './Icon';\nexport * from './Image';\nexport * from './Link';\nexport * from './Row';\nexport * from './Spinner';\nexport * from './Text';\nexport * from './Tooltip';\nexport * from './Footer';\nexport * from './Container';\nexport * from './Section';\nexport * from './Banner';\n\n/**\n * A built-in JSX element, which can be used in a Snap user interface.\n */\nexport type JSXElement =\n | StandardFormElement\n | StandardFormattingElement\n | AvatarElement\n | AddressElement\n | BoxElement\n | CardElement\n | ContainerElement\n | CopyableElement\n | DividerElement\n | FooterElement\n | ValueElement\n | HeadingElement\n | IconElement\n | ImageElement\n | LinkElement\n | RowElement\n | SectionElement\n | SpinnerElement\n | TextElement\n | TooltipElement\n | BannerElement;\n"]}
@@ -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.ValueStruct = exports.TextStruct = exports.LinkStruct = exports.HeadingStruct = 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
  */
@@ -439,13 +447,6 @@ exports.CopyableStruct = element('Copyable', {
439
447
  * A struct for the {@link DividerElement} type.
440
448
  */
441
449
  exports.DividerStruct = element('Divider');
442
- /**
443
- * A struct for the {@link ValueElement} type.
444
- */
445
- exports.ValueStruct = element('Value', {
446
- value: (0, superstruct_1.string)(),
447
- extra: (0, superstruct_1.string)(),
448
- });
449
450
  /**
450
451
  * A struct for the {@link HeadingElement} type.
451
452
  */
@@ -488,6 +489,24 @@ exports.TextStruct = element('Text', {
488
489
  (0, internals_1.literal)('warning'),
489
490
  ])),
490
491
  size: (0, superstruct_1.optional)((0, internals_1.nullUnion)([(0, internals_1.literal)('sm'), (0, internals_1.literal)('md')])),
492
+ fontWeight: (0, superstruct_1.optional)((0, internals_1.nullUnion)([(0, internals_1.literal)('regular'), (0, internals_1.literal)('medium'), (0, internals_1.literal)('bold')])),
493
+ });
494
+ /**
495
+ * A struct for the {@link ValueElement} type.
496
+ */
497
+ exports.ValueStruct = element('Value', {
498
+ value: (0, internals_1.selectiveUnion)((value) => {
499
+ if (typeof value === 'string') {
500
+ return (0, superstruct_1.string)();
501
+ }
502
+ return exports.TextStruct;
503
+ }),
504
+ extra: (0, internals_1.selectiveUnion)((value) => {
505
+ if (typeof value === 'string') {
506
+ return (0, superstruct_1.string)();
507
+ }
508
+ return exports.TextStruct;
509
+ }),
491
510
  });
492
511
  /**
493
512
  * A subset of JSX elements that are allowed as children of the Tooltip component.
@@ -529,6 +548,26 @@ exports.TooltipStruct = element('Tooltip', {
529
548
  children: (0, superstruct_1.nullable)(exports.TooltipChildStruct),
530
549
  content: exports.TooltipContentStruct,
531
550
  });
551
+ /**
552
+ * A struct for the {@link BannerElement} type.
553
+ */
554
+ exports.BannerStruct = element('Banner', {
555
+ children: children([
556
+ exports.TextStruct,
557
+ exports.LinkStruct,
558
+ exports.IconStruct,
559
+ exports.ButtonStruct,
560
+ exports.BoldStruct,
561
+ exports.ItalicStruct,
562
+ ]),
563
+ title: (0, superstruct_1.string)(),
564
+ severity: (0, superstruct_1.union)([
565
+ (0, internals_1.literal)('danger'),
566
+ (0, internals_1.literal)('info'),
567
+ (0, internals_1.literal)('success'),
568
+ (0, internals_1.literal)('warning'),
569
+ ]),
570
+ });
532
571
  /**
533
572
  * A struct for the {@link RowElement} type.
534
573
  */
@@ -580,6 +619,7 @@ exports.BoxChildStruct = (0, internals_1.typedUnion)([
580
619
  exports.SelectorStruct,
581
620
  exports.SectionStruct,
582
621
  exports.AvatarStruct,
622
+ exports.BannerStruct,
583
623
  ]);
584
624
  /**
585
625
  * A struct for the {@link ContainerElement} type.
@@ -591,6 +631,7 @@ exports.ContainerStruct = element('Container', {
591
631
  }
592
632
  return exports.BoxChildStruct;
593
633
  }),
634
+ backgroundColor: (0, superstruct_1.optional)((0, internals_1.nullUnion)([(0, internals_1.literal)('default'), (0, internals_1.literal)('alternative')])),
594
635
  });
595
636
  /**
596
637
  * For now, the allowed JSX elements at the root are the same as the allowed
@@ -636,6 +677,7 @@ exports.JSXElementStruct = (0, internals_1.typedUnion)([
636
677
  exports.SelectorOptionStruct,
637
678
  exports.SectionStruct,
638
679
  exports.AvatarStruct,
680
+ exports.BannerStruct,
639
681
  ]);
640
682
  /**
641
683
  * 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;CAC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C","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,GAA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W;IACX,qBAAa;IACb,sBAAc;IACd,oBAAY;IACZ,uBAAe;IACf,kBAAU;IACV,kBAAU;IACV,sBAAc;IACd,4BAAoB;IACpB,qBAAa;IACb,oBAAY;IACZ,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 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 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 struct for the {@link ValueElement} type.\n */\nexport const ValueStruct: Describe<ValueElement> = element('Value', {\n value: selectiveUnion((value) => {\n if (typeof value === 'string') {\n return string();\n }\n\n return TextStruct;\n }),\n extra: selectiveUnion((value) => {\n if (typeof value === 'string') {\n return string();\n }\n\n return TextStruct;\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 backgroundColor: optional(\n nullUnion([literal('default'), literal('alternative')]),\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"]}