@metamask/snaps-sdk 6.12.0 → 6.14.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (94) hide show
  1. package/CHANGELOG.md +30 -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/Icon.cjs +1 -1
  15. package/dist/jsx/components/Icon.cjs.map +1 -1
  16. package/dist/jsx/components/Icon.mjs +1 -1
  17. package/dist/jsx/components/Icon.mjs.map +1 -1
  18. package/dist/jsx/components/Text.cjs +10 -0
  19. package/dist/jsx/components/Text.cjs.map +1 -1
  20. package/dist/jsx/components/Text.d.cts +14 -0
  21. package/dist/jsx/components/Text.d.cts.map +1 -1
  22. package/dist/jsx/components/Text.d.mts +14 -0
  23. package/dist/jsx/components/Text.d.mts.map +1 -1
  24. package/dist/jsx/components/Text.mjs +10 -0
  25. package/dist/jsx/components/Text.mjs.map +1 -1
  26. package/dist/jsx/components/form/Button.cjs.map +1 -1
  27. package/dist/jsx/components/form/Button.d.cts +4 -0
  28. package/dist/jsx/components/form/Button.d.cts.map +1 -1
  29. package/dist/jsx/components/form/Button.d.mts +4 -0
  30. package/dist/jsx/components/form/Button.d.mts.map +1 -1
  31. package/dist/jsx/components/form/Button.mjs.map +1 -1
  32. package/dist/jsx/components/form/Field.cjs +1 -2
  33. package/dist/jsx/components/form/Field.cjs.map +1 -1
  34. package/dist/jsx/components/form/Field.d.cts +1 -2
  35. package/dist/jsx/components/form/Field.d.cts.map +1 -1
  36. package/dist/jsx/components/form/Field.d.mts +1 -2
  37. package/dist/jsx/components/form/Field.d.mts.map +1 -1
  38. package/dist/jsx/components/form/Field.mjs +1 -2
  39. package/dist/jsx/components/form/Field.mjs.map +1 -1
  40. package/dist/jsx/components/index.cjs +1 -0
  41. package/dist/jsx/components/index.cjs.map +1 -1
  42. package/dist/jsx/components/index.d.cts +3 -1
  43. package/dist/jsx/components/index.d.cts.map +1 -1
  44. package/dist/jsx/components/index.d.mts +3 -1
  45. package/dist/jsx/components/index.d.mts.map +1 -1
  46. package/dist/jsx/components/index.mjs +1 -0
  47. package/dist/jsx/components/index.mjs.map +1 -1
  48. package/dist/jsx/validation.cjs +52 -21
  49. package/dist/jsx/validation.cjs.map +1 -1
  50. package/dist/jsx/validation.d.cts +19 -15
  51. package/dist/jsx/validation.d.cts.map +1 -1
  52. package/dist/jsx/validation.d.mts +19 -15
  53. package/dist/jsx/validation.d.mts.map +1 -1
  54. package/dist/jsx/validation.mjs +51 -20
  55. package/dist/jsx/validation.mjs.map +1 -1
  56. package/dist/types/handlers/index.cjs +1 -0
  57. package/dist/types/handlers/index.cjs.map +1 -1
  58. package/dist/types/handlers/index.d.cts +1 -0
  59. package/dist/types/handlers/index.d.cts.map +1 -1
  60. package/dist/types/handlers/index.d.mts +1 -0
  61. package/dist/types/handlers/index.d.mts.map +1 -1
  62. package/dist/types/handlers/index.mjs +1 -0
  63. package/dist/types/handlers/index.mjs.map +1 -1
  64. package/dist/types/handlers/settings-page.cjs +3 -0
  65. package/dist/types/handlers/settings-page.cjs.map +1 -0
  66. package/dist/types/handlers/settings-page.d.cts +23 -0
  67. package/dist/types/handlers/settings-page.d.cts.map +1 -0
  68. package/dist/types/handlers/settings-page.d.mts +23 -0
  69. package/dist/types/handlers/settings-page.d.mts.map +1 -0
  70. package/dist/types/handlers/settings-page.mjs +2 -0
  71. package/dist/types/handlers/settings-page.mjs.map +1 -0
  72. package/dist/types/interface.d.cts +2 -2
  73. package/dist/types/interface.d.cts.map +1 -1
  74. package/dist/types/interface.d.mts +2 -2
  75. package/dist/types/interface.d.mts.map +1 -1
  76. package/dist/types/methods/notify.cjs.map +1 -1
  77. package/dist/types/methods/notify.d.cts +15 -2
  78. package/dist/types/methods/notify.d.cts.map +1 -1
  79. package/dist/types/methods/notify.d.mts +15 -2
  80. package/dist/types/methods/notify.d.mts.map +1 -1
  81. package/dist/types/methods/notify.mjs.map +1 -1
  82. package/dist/types/permissions.cjs.map +1 -1
  83. package/dist/types/permissions.d.cts +3 -0
  84. package/dist/types/permissions.d.cts.map +1 -1
  85. package/dist/types/permissions.d.mts +3 -0
  86. package/dist/types/permissions.d.mts.map +1 -1
  87. package/dist/types/permissions.mjs.map +1 -1
  88. package/dist/ui/components/input.cjs +1 -1
  89. package/dist/ui/components/input.cjs.map +1 -1
  90. package/dist/ui/components/input.d.cts +1 -1
  91. package/dist/ui/components/input.d.mts +1 -1
  92. package/dist/ui/components/input.mjs +1 -1
  93. package/dist/ui/components/input.mjs.map +1 -1
  94. package/package.json +3 -3
@@ -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"]}
@@ -4,8 +4,7 @@ exports.Field = void 0;
4
4
  const component_1 = require("../../component.cjs");
5
5
  const TYPE = 'Field';
6
6
  /**
7
- * A field component, which is used to create a form field. This component can
8
- * only be used as a child of the {@link Form} component.
7
+ * A field component, which is used to create a form field.
9
8
  *
10
9
  * @param props - The props of the component.
11
10
  * @param props.label - The label of the field.
@@ -1 +1 @@
1
- {"version":3,"file":"Field.cjs","sourceRoot":"","sources":["../../../../src/jsx/components/form/Field.ts"],"names":[],"mappings":";;;AACA,mDAAsD;AA8BtD,MAAM,IAAI,GAAG,OAAO,CAAC;AAErB;;;;;;;;;;;;;;;;;;GAkBG;AACU,QAAA,KAAK,GAAG,IAAA,+BAAmB,EAA0B,IAAI,CAAC,CAAC","sourcesContent":["import type { GenericSnapChildren } from '../../component';\nimport { createSnapComponent } from '../../component';\nimport type { CheckboxElement } from './Checkbox';\nimport type { DropdownElement } from './Dropdown';\nimport type { FileInputElement } from './FileInput';\nimport type { InputElement } from './Input';\nimport type { RadioGroupElement } from './RadioGroup';\nimport type { SelectorElement } from './Selector';\n\n/**\n * The props of the {@link Field} component.\n *\n * @property label - The label of the field.\n * @property error - The error message of the field.\n * @property children - The input field and the submit button.\n */\nexport type FieldProps = {\n label?: string | undefined;\n error?: string | undefined;\n children:\n | [InputElement, GenericSnapChildren]\n | [GenericSnapChildren, InputElement]\n | [GenericSnapChildren, InputElement, GenericSnapChildren]\n | DropdownElement\n | RadioGroupElement\n | FileInputElement\n | InputElement\n | CheckboxElement\n | SelectorElement;\n};\n\nconst TYPE = 'Field';\n\n/**\n * A field component, which is used to create a form field. This component can\n * only be used as a child of the {@link Form} component.\n *\n * @param props - The props of the component.\n * @param props.label - The label of the field.\n * @param props.error - The error message of the field.\n * @param props.children - The input field and the submit button.\n * @returns A field element.\n * @example\n * <Field label=\"Username\">\n * <Input name=\"username\" type=\"text\" />\n * <Button type=\"submit\">Submit</Button>\n * </Field>\n * @example\n * <Field label=\"Upload file\">\n * <FileInput name=\"file\" accept={['image/*']} multiple />\n * </Field>\n */\nexport const Field = createSnapComponent<FieldProps, typeof TYPE>(TYPE);\n\n/**\n * A field element.\n *\n * @see Field\n */\nexport type FieldElement = ReturnType<typeof Field>;\n"]}
1
+ {"version":3,"file":"Field.cjs","sourceRoot":"","sources":["../../../../src/jsx/components/form/Field.ts"],"names":[],"mappings":";;;AACA,mDAAsD;AA8BtD,MAAM,IAAI,GAAG,OAAO,CAAC;AAErB;;;;;;;;;;;;;;;;;GAiBG;AACU,QAAA,KAAK,GAAG,IAAA,+BAAmB,EAA0B,IAAI,CAAC,CAAC","sourcesContent":["import type { GenericSnapChildren } from '../../component';\nimport { createSnapComponent } from '../../component';\nimport type { CheckboxElement } from './Checkbox';\nimport type { DropdownElement } from './Dropdown';\nimport type { FileInputElement } from './FileInput';\nimport type { InputElement } from './Input';\nimport type { RadioGroupElement } from './RadioGroup';\nimport type { SelectorElement } from './Selector';\n\n/**\n * The props of the {@link Field} component.\n *\n * @property label - The label of the field.\n * @property error - The error message of the field.\n * @property children - The input field and the submit button.\n */\nexport type FieldProps = {\n label?: string | undefined;\n error?: string | undefined;\n children:\n | [InputElement, GenericSnapChildren]\n | [GenericSnapChildren, InputElement]\n | [GenericSnapChildren, InputElement, GenericSnapChildren]\n | DropdownElement\n | RadioGroupElement\n | FileInputElement\n | InputElement\n | CheckboxElement\n | SelectorElement;\n};\n\nconst TYPE = 'Field';\n\n/**\n * A field component, which is used to create a form field.\n *\n * @param props - The props of the component.\n * @param props.label - The label of the field.\n * @param props.error - The error message of the field.\n * @param props.children - The input field and the submit button.\n * @returns A field element.\n * @example\n * <Field label=\"Username\">\n * <Input name=\"username\" type=\"text\" />\n * <Button type=\"submit\">Submit</Button>\n * </Field>\n * @example\n * <Field label=\"Upload file\">\n * <FileInput name=\"file\" accept={['image/*']} multiple />\n * </Field>\n */\nexport const Field = createSnapComponent<FieldProps, typeof TYPE>(TYPE);\n\n/**\n * A field element.\n *\n * @see Field\n */\nexport type FieldElement = ReturnType<typeof Field>;\n"]}
@@ -18,8 +18,7 @@ export type FieldProps = {
18
18
  children: [InputElement, GenericSnapChildren] | [GenericSnapChildren, InputElement] | [GenericSnapChildren, InputElement, GenericSnapChildren] | DropdownElement | RadioGroupElement | FileInputElement | InputElement | CheckboxElement | SelectorElement;
19
19
  };
20
20
  /**
21
- * A field component, which is used to create a form field. This component can
22
- * only be used as a child of the {@link Form} component.
21
+ * A field component, which is used to create a form field.
23
22
  *
24
23
  * @param props - The props of the component.
25
24
  * @param props.label - The label of the field.
@@ -1 +1 @@
1
- {"version":3,"file":"Field.d.cts","sourceRoot":"","sources":["../../../../src/jsx/components/form/Field.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,mBAAmB,EAAE,4BAAwB;AAE3D,OAAO,KAAK,EAAE,eAAe,EAAE,uBAAmB;AAClD,OAAO,KAAK,EAAE,eAAe,EAAE,uBAAmB;AAClD,OAAO,KAAK,EAAE,gBAAgB,EAAE,wBAAoB;AACpD,OAAO,KAAK,EAAE,YAAY,EAAE,oBAAgB;AAC5C,OAAO,KAAK,EAAE,iBAAiB,EAAE,yBAAqB;AACtD,OAAO,KAAK,EAAE,eAAe,EAAE,uBAAmB;AA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Ae,GACf,iBAAiB,GACjB,gBAAgB,GAChB,YAAY,GACZ,eAAe,GACf,eAAe,CAAC;CACrB,CAAC;AAIF;;;;;;;;;;;;;;;;;GAiBG;AACH,eAAO,MAAM,KAAK,8DAAqD,CAAC;AAExE;;;;GAIG;AACH,MAAM,MAAM,YAAY,GAAG,UAAU,CAAC,OAAO,KAAK,CAAC,CAAC"}
@@ -18,8 +18,7 @@ export type FieldProps = {
18
18
  children: [InputElement, GenericSnapChildren] | [GenericSnapChildren, InputElement] | [GenericSnapChildren, InputElement, GenericSnapChildren] | DropdownElement | RadioGroupElement | FileInputElement | InputElement | CheckboxElement | SelectorElement;
19
19
  };
20
20
  /**
21
- * A field component, which is used to create a form field. This component can
22
- * only be used as a child of the {@link Form} component.
21
+ * A field component, which is used to create a form field.
23
22
  *
24
23
  * @param props - The props of the component.
25
24
  * @param props.label - The label of the field.
@@ -1 +1 @@
1
- {"version":3,"file":"Field.d.mts","sourceRoot":"","sources":["../../../../src/jsx/components/form/Field.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,mBAAmB,EAAE,4BAAwB;AAE3D,OAAO,KAAK,EAAE,eAAe,EAAE,uBAAmB;AAClD,OAAO,KAAK,EAAE,eAAe,EAAE,uBAAmB;AAClD,OAAO,KAAK,EAAE,gBAAgB,EAAE,wBAAoB;AACpD,OAAO,KAAK,EAAE,YAAY,EAAE,oBAAgB;AAC5C,OAAO,KAAK,EAAE,iBAAiB,EAAE,yBAAqB;AACtD,OAAO,KAAK,EAAE,eAAe,EAAE,uBAAmB;AAElD;;;;;;GAMG;AACH,MAAM,MAAM,UAAU,GAAG;IACvB,KAAK,CAAC,EAAE,MAAM,GAAG,SAAS,CAAC;IAC3B,KAAK,CAAC,EAAE,MAAM,GAAG,SAAS,CAAC;IAC3B,QAAQ,EACJ,CAAC,YAAY,EAAE,mBAAmB,CAAC,GACnC,CAAC,mBAAmB,EAAE,YAAY,CAAC,GACnC,CAAC,mBAAmB,EAAE,YAAY,EAAE,mBAAmB,CAAC,GACxD,eAAe,GACf,iBAAiB,GACjB,gBAAgB,GAChB,YAAY,GACZ,eAAe,GACf,eAAe,CAAC;CACrB,CAAC;AAIF;;;;;;;;;;;;;;;;;;GAkBG;AACH,eAAO,MAAM,KAAK,8DAAqD,CAAC;AAExE;;;;GAIG;AACH,MAAM,MAAM,YAAY,GAAG,UAAU,CAAC,OAAO,KAAK,CAAC,CAAC"}
1
+ {"version":3,"file":"Field.d.mts","sourceRoot":"","sources":["../../../../src/jsx/components/form/Field.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,mBAAmB,EAAE,4BAAwB;AAE3D,OAAO,KAAK,EAAE,eAAe,EAAE,uBAAmB;AAClD,OAAO,KAAK,EAAE,eAAe,EAAE,uBAAmB;AAClD,OAAO,KAAK,EAAE,gBAAgB,EAAE,wBAAoB;AACpD,OAAO,KAAK,EAAE,YAAY,EAAE,oBAAgB;AAC5C,OAAO,KAAK,EAAE,iBAAiB,EAAE,yBAAqB;AACtD,OAAO,KAAK,EAAE,eAAe,EAAE,uBAAmB;AAElD;;;;;;GAMG;AACH,MAAM,MAAM,UAAU,GAAG;IACvB,KAAK,CAAC,EAAE,MAAM,GAAG,SAAS,CAAC;IAC3B,KAAK,CAAC,EAAE,MAAM,GAAG,SAAS,CAAC;IAC3B,QAAQ,EACJ,CAAC,YAAY,EAAE,mBAAmB,CAAC,GACnC,CAAC,mBAAmB,EAAE,YAAY,CAAC,GACnC,CAAC,mBAAmB,EAAE,YAAY,EAAE,mBAAmB,CAAC,GACxD,eAAe,GACf,iBAAiB,GACjB,gBAAgB,GAChB,YAAY,GACZ,eAAe,GACf,eAAe,CAAC;CACrB,CAAC;AAIF;;;;;;;;;;;;;;;;;GAiBG;AACH,eAAO,MAAM,KAAK,8DAAqD,CAAC;AAExE;;;;GAIG;AACH,MAAM,MAAM,YAAY,GAAG,UAAU,CAAC,OAAO,KAAK,CAAC,CAAC"}
@@ -1,8 +1,7 @@
1
1
  import { createSnapComponent } from "../../component.mjs";
2
2
  const TYPE = 'Field';
3
3
  /**
4
- * A field component, which is used to create a form field. This component can
5
- * only be used as a child of the {@link Form} component.
4
+ * A field component, which is used to create a form field.
6
5
  *
7
6
  * @param props - The props of the component.
8
7
  * @param props.label - The label of the field.
@@ -1 +1 @@
1
- {"version":3,"file":"Field.mjs","sourceRoot":"","sources":["../../../../src/jsx/components/form/Field.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,mBAAmB,EAAE,4BAAwB;AA8BtD,MAAM,IAAI,GAAG,OAAO,CAAC;AAErB;;;;;;;;;;;;;;;;;;GAkBG;AACH,MAAM,CAAC,MAAM,KAAK,GAAG,mBAAmB,CAA0B,IAAI,CAAC,CAAC","sourcesContent":["import type { GenericSnapChildren } from '../../component';\nimport { createSnapComponent } from '../../component';\nimport type { CheckboxElement } from './Checkbox';\nimport type { DropdownElement } from './Dropdown';\nimport type { FileInputElement } from './FileInput';\nimport type { InputElement } from './Input';\nimport type { RadioGroupElement } from './RadioGroup';\nimport type { SelectorElement } from './Selector';\n\n/**\n * The props of the {@link Field} component.\n *\n * @property label - The label of the field.\n * @property error - The error message of the field.\n * @property children - The input field and the submit button.\n */\nexport type FieldProps = {\n label?: string | undefined;\n error?: string | undefined;\n children:\n | [InputElement, GenericSnapChildren]\n | [GenericSnapChildren, InputElement]\n | [GenericSnapChildren, InputElement, GenericSnapChildren]\n | DropdownElement\n | RadioGroupElement\n | FileInputElement\n | InputElement\n | CheckboxElement\n | SelectorElement;\n};\n\nconst TYPE = 'Field';\n\n/**\n * A field component, which is used to create a form field. This component can\n * only be used as a child of the {@link Form} component.\n *\n * @param props - The props of the component.\n * @param props.label - The label of the field.\n * @param props.error - The error message of the field.\n * @param props.children - The input field and the submit button.\n * @returns A field element.\n * @example\n * <Field label=\"Username\">\n * <Input name=\"username\" type=\"text\" />\n * <Button type=\"submit\">Submit</Button>\n * </Field>\n * @example\n * <Field label=\"Upload file\">\n * <FileInput name=\"file\" accept={['image/*']} multiple />\n * </Field>\n */\nexport const Field = createSnapComponent<FieldProps, typeof TYPE>(TYPE);\n\n/**\n * A field element.\n *\n * @see Field\n */\nexport type FieldElement = ReturnType<typeof Field>;\n"]}
1
+ {"version":3,"file":"Field.mjs","sourceRoot":"","sources":["../../../../src/jsx/components/form/Field.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,mBAAmB,EAAE,4BAAwB;AA8BtD,MAAM,IAAI,GAAG,OAAO,CAAC;AAErB;;;;;;;;;;;;;;;;;GAiBG;AACH,MAAM,CAAC,MAAM,KAAK,GAAG,mBAAmB,CAA0B,IAAI,CAAC,CAAC","sourcesContent":["import type { GenericSnapChildren } from '../../component';\nimport { createSnapComponent } from '../../component';\nimport type { CheckboxElement } from './Checkbox';\nimport type { DropdownElement } from './Dropdown';\nimport type { FileInputElement } from './FileInput';\nimport type { InputElement } from './Input';\nimport type { RadioGroupElement } from './RadioGroup';\nimport type { SelectorElement } from './Selector';\n\n/**\n * The props of the {@link Field} component.\n *\n * @property label - The label of the field.\n * @property error - The error message of the field.\n * @property children - The input field and the submit button.\n */\nexport type FieldProps = {\n label?: string | undefined;\n error?: string | undefined;\n children:\n | [InputElement, GenericSnapChildren]\n | [GenericSnapChildren, InputElement]\n | [GenericSnapChildren, InputElement, GenericSnapChildren]\n | DropdownElement\n | RadioGroupElement\n | FileInputElement\n | InputElement\n | CheckboxElement\n | SelectorElement;\n};\n\nconst TYPE = 'Field';\n\n/**\n * A field component, which is used to create a form field.\n *\n * @param props - The props of the component.\n * @param props.label - The label of the field.\n * @param props.error - The error message of the field.\n * @param props.children - The input field and the submit button.\n * @returns A field element.\n * @example\n * <Field label=\"Username\">\n * <Input name=\"username\" type=\"text\" />\n * <Button type=\"submit\">Submit</Button>\n * </Field>\n * @example\n * <Field label=\"Upload file\">\n * <FileInput name=\"file\" accept={['image/*']} multiple />\n * </Field>\n */\nexport const Field = createSnapComponent<FieldProps, typeof TYPE>(TYPE);\n\n/**\n * A field element.\n *\n * @see Field\n */\nexport type FieldElement = ReturnType<typeof Field>;\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,OAAO,KAAK,EAAE,YAAY,EAAE,oBAAgB;AAC5C,OAAO,KAAK,EAAE,WAAW,EAAE,mBAAe;AAC1C,OAAO,KAAK,EAAE,UAAU,EAAE,kBAAc;AACxC,OAAO,KAAK,EAAE,cAAc,EAAE,sBAAkB;AAChD,OAAO,KAAK,EAAE,cAAc,EAAE,sBAAkB;AAChD,OAAO,KAAK,EAAE,WAAW,EAAE,mBAAe;AAC1C,OAAO,KAAK,EAAE,cAAc,EAAE,sBAAkB;AAChD,OAAO,KAAK,EAAE,YAAY,EAAE,oBAAgB;AAE5C,iCAAuB;AACvB,uCAA6B;AAC7B,8BAA0B;AAC1B,6BAAyB;AACzB,0BAAsB;AACtB,2BAAuB;AACvB,+BAA2B;AAC3B,8BAA0B;AAC1B,4BAAwB;AACxB,8BAA0B;AAC1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AK,EAAE,cAAc,EAAE,sBAAkB;AAChD,OAAO,KAAK,EAAE,cAAc,EAAE,sBAAkB;AAChD,OAAO,KAAK,EAAE,WAAW,EAAE,mBAAe;AAC1C,OAAO,KAAK,EAAE,cAAc,EAAE,sBAAkB;AAChD,OAAO,KAAK,EAAE,YAAY,EAAE,oBAAgB;AAE5C,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;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"}
@@ -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,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,OAAO,KAAK,EAAE,YAAY,EAAE,oBAAgB;AAC5C,OAAO,KAAK,EAAE,WAAW,EAAE,mBAAe;AAC1C,OAAO,KAAK,EAAE,UAAU,EAAE,kBAAc;AACxC,OAAO,KAAK,EAAE,cAAc,EAAE,sBAAkB;AAChD,OAAO,KAAK,EAAE,cAAc,EAAE,sBAAkB;AAChD,OAAO,KAAK,EAAE,WAAW,EAAE,mBAAe;AAC1C,OAAO,KAAK,EAAE,cAAc,EAAE,sBAAkB;AAChD,OAAO,KAAK,EAAE,YAAY,EAAE,oBAAgB;AAE5C,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;AAE1B;;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,CAAC"}
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,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,OAAO,KAAK,EAAE,YAAY,EAAE,oBAAgB;AAC5C,OAAO,KAAK,EAAE,WAAW,EAAE,mBAAe;AAC1C,OAAO,KAAK,EAAE,UAAU,EAAE,kBAAc;AACxC,OAAO,KAAK,EAAE,cAAc,EAAE,sBAAkB;AAChD,OAAO,KAAK,EAAE,cAAc,EAAE,sBAAkB;AAChD,OAAO,KAAK,EAAE,WAAW,EAAE,mBAAe;AAC1C,OAAO,KAAK,EAAE,cAAc,EAAE,sBAAkB;AAChD,OAAO,KAAK,EAAE,YAAY,EAAE,oBAAgB;AAE5C,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;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.BoxStruct = exports.BoxChildrenStruct = exports.AvatarStruct = exports.FormattingStruct = exports.ItalicStruct = exports.BoldStruct = exports.FormStruct = exports.FormChildStruct = exports.FieldStruct = exports.FieldChildUnionStruct = exports.FileInputStruct = exports.RadioGroupStruct = exports.RadioStruct = exports.SelectorStruct = exports.SelectorOptionStruct = exports.CardStruct = exports.AddressStruct = exports.DropdownStruct = exports.OptionStruct = exports.InputStruct = exports.NumberInputPropsStruct = exports.PasswordInputPropsStruct = exports.TextInputPropsStruct = exports.GenericInputPropsStruct = exports.CheckboxStruct = exports.ButtonStruct = exports.IconStruct = exports.ImageStruct = exports.ElementStruct = exports.StringElementStruct = exports.KeyStruct = void 0;
4
- exports.assertJSXElement = exports.isJSXElementUnsafe = void 0;
3
+ exports.JSXElementStruct = exports.RootJSXElementStruct = exports.ContainerStruct = exports.BoxChildStruct = exports.SpinnerStruct = exports.RowStruct = exports.BannerStruct = exports.TooltipStruct = exports.TooltipContentStruct = exports.TooltipChildStruct = exports.TextStruct = exports.LinkStruct = exports.HeadingStruct = exports.ValueStruct = exports.DividerStruct = exports.CopyableStruct = exports.FooterStruct = exports.FooterChildStruct = exports.SectionStruct = exports.FormStruct = exports.FormChildStruct = exports.BoxStruct = exports.BoxChildrenStruct = exports.AvatarStruct = exports.FormattingStruct = exports.ItalicStruct = exports.BoldStruct = exports.FieldStruct = exports.FieldChildUnionStruct = exports.FileInputStruct = exports.RadioGroupStruct = exports.RadioStruct = exports.SelectorStruct = exports.SelectorOptionStruct = exports.CardStruct = exports.AddressStruct = exports.DropdownStruct = exports.OptionStruct = exports.InputStruct = exports.NumberInputPropsStruct = exports.PasswordInputPropsStruct = exports.TextInputPropsStruct = exports.GenericInputPropsStruct = exports.CheckboxStruct = exports.ButtonStruct = exports.IconStruct = exports.ImageStruct = exports.ElementStruct = exports.StringElementStruct = exports.KeyStruct = void 0;
4
+ exports.assertJSXElement = exports.isJSXElementUnsafe = exports.isJSXElement = void 0;
5
5
  const superstruct_1 = require("@metamask/superstruct");
6
6
  const utils_1 = require("@metamask/utils");
7
7
  const internals_1 = require("../internals/index.cjs");
@@ -124,7 +124,9 @@ exports.ButtonStruct = element('Button', {
124
124
  name: (0, superstruct_1.optional)((0, superstruct_1.string)()),
125
125
  type: (0, superstruct_1.optional)((0, internals_1.nullUnion)([(0, internals_1.literal)('button'), (0, internals_1.literal)('submit')])),
126
126
  variant: (0, superstruct_1.optional)((0, internals_1.nullUnion)([(0, internals_1.literal)('primary'), (0, internals_1.literal)('destructive')])),
127
+ size: (0, superstruct_1.optional)((0, internals_1.nullUnion)([(0, internals_1.literal)('sm'), (0, internals_1.literal)('md')])),
127
128
  disabled: (0, superstruct_1.optional)((0, superstruct_1.boolean)()),
129
+ loading: (0, superstruct_1.optional)((0, superstruct_1.boolean)()),
128
130
  form: (0, superstruct_1.optional)((0, superstruct_1.string)()),
129
131
  });
130
132
  /**
@@ -311,12 +313,18 @@ exports.FieldChildUnionStruct = (0, internals_1.nullUnion)([
311
313
  /**
312
314
  * A subset of JSX elements that are allowed as children of the Field component.
313
315
  */
314
- const FieldChildStruct = (0, internals_1.nullUnion)([
315
- (0, superstruct_1.tuple)(BOX_INPUT_LEFT),
316
- (0, superstruct_1.tuple)(BOX_INPUT_RIGHT),
317
- (0, superstruct_1.tuple)(BOX_INPUT_BOTH),
318
- ...FIELD_CHILDREN_ARRAY,
319
- ]);
316
+ const FieldChildStruct = (0, internals_1.selectiveUnion)((value) => {
317
+ const isArray = Array.isArray(value);
318
+ if (isArray && value.length === 3) {
319
+ return (0, superstruct_1.tuple)(BOX_INPUT_BOTH);
320
+ }
321
+ if (isArray && value.length === 2) {
322
+ return value[0]?.type === 'Box'
323
+ ? (0, superstruct_1.tuple)(BOX_INPUT_LEFT)
324
+ : (0, superstruct_1.tuple)(BOX_INPUT_RIGHT);
325
+ }
326
+ return (0, internals_1.typedUnion)(FIELD_CHILDREN_ARRAY);
327
+ });
320
328
  /**
321
329
  * A struct for the {@link FieldElement} type.
322
330
  */
@@ -325,19 +333,6 @@ exports.FieldStruct = element('Field', {
325
333
  error: (0, superstruct_1.optional)((0, superstruct_1.string)()),
326
334
  children: FieldChildStruct,
327
335
  });
328
- /**
329
- * A subset of JSX elements that are allowed as children of the Form component.
330
- */
331
- exports.FormChildStruct = children(
332
- // eslint-disable-next-line @typescript-eslint/no-use-before-define
333
- [exports.FieldStruct, (0, superstruct_1.lazy)(() => exports.BoxChildStruct)]);
334
- /**
335
- * A struct for the {@link FormElement} type.
336
- */
337
- exports.FormStruct = element('Form', {
338
- children: exports.FormChildStruct,
339
- name: (0, superstruct_1.string)(),
340
- });
341
336
  /**
342
337
  * A struct for the {@link BoldElement} type.
343
338
  */
@@ -384,6 +379,17 @@ exports.BoxStruct = element('Box', {
384
379
  ])),
385
380
  center: (0, superstruct_1.optional)((0, superstruct_1.boolean)()),
386
381
  });
382
+ /**
383
+ * A subset of JSX elements that are allowed as children of the Form component.
384
+ */
385
+ exports.FormChildStruct = exports.BoxChildrenStruct;
386
+ /**
387
+ * A struct for the {@link FormElement} type.
388
+ */
389
+ exports.FormStruct = element('Form', {
390
+ children: exports.FormChildStruct,
391
+ name: (0, superstruct_1.string)(),
392
+ });
387
393
  const FooterButtonStruct = (0, superstruct_1.refine)(exports.ButtonStruct, 'FooterButton', (value) => {
388
394
  if (typeof value.props.children === 'string' ||
389
395
  typeof value.props.children === 'boolean' ||
@@ -489,6 +495,8 @@ exports.TextStruct = element('Text', {
489
495
  (0, internals_1.literal)('success'),
490
496
  (0, internals_1.literal)('warning'),
491
497
  ])),
498
+ size: (0, superstruct_1.optional)((0, internals_1.nullUnion)([(0, internals_1.literal)('sm'), (0, internals_1.literal)('md')])),
499
+ fontWeight: (0, superstruct_1.optional)((0, internals_1.nullUnion)([(0, internals_1.literal)('regular'), (0, internals_1.literal)('medium'), (0, internals_1.literal)('bold')])),
492
500
  });
493
501
  /**
494
502
  * A subset of JSX elements that are allowed as children of the Tooltip component.
@@ -530,6 +538,26 @@ exports.TooltipStruct = element('Tooltip', {
530
538
  children: (0, superstruct_1.nullable)(exports.TooltipChildStruct),
531
539
  content: exports.TooltipContentStruct,
532
540
  });
541
+ /**
542
+ * A struct for the {@link BannerElement} type.
543
+ */
544
+ exports.BannerStruct = element('Banner', {
545
+ children: children([
546
+ exports.TextStruct,
547
+ exports.LinkStruct,
548
+ exports.IconStruct,
549
+ exports.ButtonStruct,
550
+ exports.BoldStruct,
551
+ exports.ItalicStruct,
552
+ ]),
553
+ title: (0, superstruct_1.string)(),
554
+ severity: (0, superstruct_1.union)([
555
+ (0, internals_1.literal)('danger'),
556
+ (0, internals_1.literal)('info'),
557
+ (0, internals_1.literal)('success'),
558
+ (0, internals_1.literal)('warning'),
559
+ ]),
560
+ });
533
561
  /**
534
562
  * A struct for the {@link RowElement} type.
535
563
  */
@@ -563,6 +591,7 @@ exports.BoxChildStruct = (0, internals_1.typedUnion)([
563
591
  exports.DividerStruct,
564
592
  exports.DropdownStruct,
565
593
  exports.RadioGroupStruct,
594
+ exports.FieldStruct,
566
595
  exports.FileInputStruct,
567
596
  exports.FormStruct,
568
597
  exports.HeadingStruct,
@@ -580,6 +609,7 @@ exports.BoxChildStruct = (0, internals_1.typedUnion)([
580
609
  exports.SelectorStruct,
581
610
  exports.SectionStruct,
582
611
  exports.AvatarStruct,
612
+ exports.BannerStruct,
583
613
  ]);
584
614
  /**
585
615
  * A struct for the {@link ContainerElement} type.
@@ -636,6 +666,7 @@ exports.JSXElementStruct = (0, internals_1.typedUnion)([
636
666
  exports.SelectorOptionStruct,
637
667
  exports.SectionStruct,
638
668
  exports.AvatarStruct,
669
+ exports.BannerStruct,
639
670
  ]);
640
671
  /**
641
672
  * Check if a value is a JSX element.
@@ -1 +1 @@
1
- {"version":3,"file":"validation.cjs","sourceRoot":"","sources":["../../src/jsx/validation.ts"],"names":[],"mappings":";;;;AAOA,uDAc+B;AAC/B,2CAMyB;AAGzB,sDAMsB;AAatB,uDAmCsB;AAEtB;;GAEG;AACU,QAAA,SAAS,GAAkB,IAAA,qBAAS,EAAC,CAAC,IAAA,oBAAM,GAAE,EAAE,IAAA,oBAAM,GAAE,CAAC,CAAC,CAAC;AAExE;;GAEG;AACU,QAAA,mBAAmB,GAA4B,QAAQ,CAAC;IACnE,IAAA,oBAAM,GAAE;CACT,CAAC,CAAC;AAEH;;GAEG;AACU,QAAA,aAAa,GAAiC,IAAA,oBAAM,EAAC;IAChE,IAAI,EAAE,IAAA,oBAAM,GAAE;IACd,KAAK,EAAE,IAAA,oBAAM,EAAC,IAAA,oBAAM,GAAE,EAAE,kBAAU,CAAC;IACnC,GAAG,EAAE,IAAA,sBAAQ,EAAC,iBAAS,CAAC;CACzB,CAAC,CAAC;AAEH;;;;;GAKG;AACH,SAAS,QAAQ,CACf,MAA4B;IAE5B,MAAM,cAAc,GAA2B,IAAA,0BAAc,EAAC,CAAC,KAAK,EAAE,EAAE;QACtE,IAAI,KAAK,CAAC,OAAO,CAAC,KAAK,CAAC,EAAE,CAAC;YACzB,OAAO,IAAA,mBAAK,EAAC,I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ACV,iBAAS;IACT,qBAAa;IACb,kBAAU;IACV,sBAAc;IACd,oBAAY;IACZ,wBAAgB;IAChB,mBAAW;IACX,mBAAW;IACX,qBAAa;IACb,sBAAc;IACd,oBAAY;IACZ,uBAAe;IACf,kBAAU;IACV,kBAAU;IACV,sBAAc;IACd,4BAAoB;IACpB,qBAAa;IACb,oBAAY;CACb,CAAC,CAAC;AAEH;;;;;GAKG;AACH,SAAgB,YAAY,CAAC,KAAc;IACzC,OAAO,IAAA,gBAAE,EAAC,KAAK,EAAE,wBAAgB,CAAC,CAAC;AACrC,CAAC;AAFD,oCAEC;AAED;;;;;;;;;;GAUG;AACH,SAAgB,kBAAkB,CAAC,KAAc;IAC/C,OAAO,CACL,IAAA,qBAAa,EAAC,KAAK,CAAC;QACpB,IAAA,mBAAW,EAAC,KAAK,EAAE,MAAM,CAAC;QAC1B,IAAA,mBAAW,EAAC,KAAK,EAAE,OAAO,CAAC;QAC3B,IAAA,mBAAW,EAAC,KAAK,EAAE,KAAK,CAAC,CAC1B,CAAC;AACJ,CAAC;AAPD,gDAOC;AAED;;;;;GAKG;AACH,SAAgB,gBAAgB,CAAC,KAAc;IAC7C,4EAA4E;IAC5E,0EAA0E;IAC1E,2DAA2D;IAC3D,IAAI,CAAC,YAAY,CAAC,KAAK,CAAC,EAAE,CAAC;QACzB,MAAM,IAAI,KAAK,CACb,wCAAwC,IAAI,CAAC,SAAS,CACpD,KAAK,CACN,qFAAqF,CACvF,CAAC;IACJ,CAAC;AACH,CAAC;AAXD,4CAWC","sourcesContent":["import type {\n AnyStruct,\n Infer,\n InferStructTuple,\n ObjectSchema,\n Struct,\n} from '@metamask/superstruct';\nimport {\n is,\n boolean,\n optional,\n array,\n lazy,\n nullable,\n number,\n object,\n record,\n string,\n tuple,\n refine,\n assign,\n} from '@metamask/superstruct';\nimport {\n CaipAccountIdStruct,\n hasProperty,\n HexChecksumAddressStruct,\n isPlainObject,\n JsonStruct,\n} from '@metamask/utils';\n\nimport type { Describe } from '../internals';\nimport {\n literal,\n nullUnion,\n selectiveUnion,\n svg,\n typedUnion,\n} from '../internals';\nimport type { EmptyObject } from '../types';\nimport type {\n GenericSnapChildren,\n GenericSnapElement,\n JsonObject,\n Key,\n Nestable,\n SnapElement,\n SnapsChildren,\n StringElement,\n} from './component';\nimport type { AvatarElement } from './components';\nimport {\n type AddressElement,\n type BoldElement,\n type BoxElement,\n type ButtonElement,\n type CheckboxElement,\n type CardElement,\n type CopyableElement,\n type DividerElement,\n type DropdownElement,\n type OptionElement,\n type RadioElement,\n type RadioGroupElement,\n type FieldElement,\n type FormElement,\n type HeadingElement,\n type ImageElement,\n type InputElement,\n type ItalicElement,\n type JSXElement,\n type LinkElement,\n type RowElement,\n type SpinnerElement,\n type StandardFormattingElement,\n type TextElement,\n type TooltipElement,\n type ValueElement,\n type FileInputElement,\n type ContainerElement,\n type FooterElement,\n type IconElement,\n type SectionElement,\n type SelectorElement,\n type SelectorOptionElement,\n IconName,\n} from './components';\n\n/**\n * A struct for the {@link Key} type.\n */\nexport const KeyStruct: Describe<Key> = nullUnion([string(), number()]);\n\n/**\n * A struct for the {@link StringElement} type.\n */\nexport const StringElementStruct: Describe<StringElement> = children([\n string(),\n]);\n\n/**\n * A struct for the {@link GenericSnapElement} type.\n */\nexport const ElementStruct: Describe<GenericSnapElement> = object({\n type: string(),\n props: record(string(), JsonStruct),\n key: nullable(KeyStruct),\n});\n\n/**\n * A helper function for creating a struct for a {@link Nestable} type.\n *\n * @param struct - The struct for the type to test.\n * @returns The struct for the nestable type.\n */\nfunction nestable<Type, Schema>(\n struct: Struct<Type, Schema>,\n): Struct<Nestable<Type>, any> {\n const nestableStruct: Struct<Nestable<Type>> = selectiveUnion((value) => {\n if (Array.isArray(value)) {\n return array(lazy(() => nestableStruct));\n }\n return struct;\n });\n\n return nestableStruct;\n}\n\n/**\n * A helper function for creating a struct which allows children of a specific\n * type, as well as `null` and `boolean`.\n *\n * @param structs - The structs to allow as children.\n * @returns The struct for the children.\n */\nfunction children<Head extends AnyStruct, Tail extends AnyStruct[]>(\n structs: [head: Head, ...tail: Tail],\n): Struct<\n Nestable<Infer<Head> | InferStructTuple<Tail>[number] | boolean | null>,\n null\n> {\n return nestable(\n nullable(\n selectiveUnion((value) => {\n if (typeof value === 'boolean') {\n return boolean();\n }\n if (structs.length === 1) {\n return structs[0];\n }\n return nullUnion(structs);\n }),\n ),\n ) as unknown as Struct<\n Nestable<Infer<Head> | InferStructTuple<Tail>[number] | boolean | null>,\n null\n >;\n}\n\n/**\n * A helper function for creating a struct which allows a single child of a specific\n * type, as well as `null` and `boolean`.\n *\n * @param struct - The struct to allow as a single child.\n * @returns The struct for the children.\n */\nfunction singleChild<Type extends AnyStruct>(\n struct: Type,\n): Struct<Infer<Type> | boolean | null, null> {\n return nullable(\n selectiveUnion((value) => {\n if (typeof value === 'boolean') {\n return boolean();\n }\n\n return struct;\n }),\n ) as unknown as Struct<Infer<Type> | boolean | null, null>;\n}\n\n/**\n * A helper function for creating a struct for a JSX element.\n *\n * @param name - The name of the element.\n * @param props - The props of the element.\n * @returns The struct for the element.\n */\nfunction element<Name extends string, Props extends ObjectSchema = EmptyObject>(\n name: Name,\n props: Props = {} as Props,\n) {\n return object({\n type: literal(name) as unknown as Struct<Name, Name>,\n props: object(props),\n key: nullable(KeyStruct),\n });\n}\n\n/**\n * A helper function for creating a struct for a JSX element with selective props.\n *\n * @param name - The name of the element.\n * @param selector - The selector function choosing the struct to validate with.\n * @returns The struct for the element.\n */\nfunction elementWithSelectiveProps<\n Name extends string,\n Selector extends (value: any) => AnyStruct,\n>(name: Name, selector: Selector) {\n return object({\n type: literal(name) as unknown as Struct<Name, Name>,\n props: selectiveUnion(selector),\n key: nullable(KeyStruct),\n });\n}\n\n/**\n * A struct for the {@link ImageElement} type.\n */\nexport const ImageStruct: Describe<ImageElement> = element('Image', {\n src: svg(),\n alt: optional(string()),\n});\n\nconst IconNameStruct: Struct<`${IconName}`, null> = nullUnion(\n Object.values(IconName).map((name) => literal(name)) as any,\n);\n\n/**\n * A struct for the {@link IconElement} type.\n */\nexport const IconStruct: Describe<IconElement> = element('Icon', {\n name: IconNameStruct,\n color: optional(\n nullUnion([literal('default'), literal('primary'), literal('muted')]),\n ),\n size: optional(nullUnion([literal('md'), literal('inherit')])),\n});\n\n/**\n * A struct for the {@link ButtonElement} type.\n */\nexport const ButtonStruct: Describe<ButtonElement> = element('Button', {\n children: children([StringElementStruct, ImageStruct, IconStruct]),\n name: optional(string()),\n type: optional(nullUnion([literal('button'), literal('submit')])),\n variant: optional(nullUnion([literal('primary'), literal('destructive')])),\n disabled: optional(boolean()),\n form: optional(string()),\n});\n\n/**\n * A struct for the {@link CheckboxElement} type.\n */\nexport const CheckboxStruct: Describe<CheckboxElement> = element('Checkbox', {\n name: string(),\n checked: optional(boolean()),\n label: optional(string()),\n variant: optional(nullUnion([literal('default'), literal('toggle')])),\n});\n\n/**\n * A struct for the generic input element props.\n */\nexport const GenericInputPropsStruct = object({\n name: string(),\n value: optional(string()),\n placeholder: optional(string()),\n});\n\n/**\n * A struct for the text type input props.\n */\nexport const TextInputPropsStruct = assign(\n GenericInputPropsStruct,\n object({\n type: literal('text'),\n }),\n);\n\n/**\n * A struct for the password type input props.\n */\nexport const PasswordInputPropsStruct = assign(\n GenericInputPropsStruct,\n object({\n type: literal('password'),\n }),\n);\n\n/**\n * A struct for the number type input props.\n */\nexport const NumberInputPropsStruct = assign(\n GenericInputPropsStruct,\n object({\n type: literal('number'),\n min: optional(number()),\n max: optional(number()),\n step: optional(number()),\n }),\n);\n\n/**\n * A struct for the {@link InputElement} type.\n */\nexport const InputStruct: Describe<InputElement> = elementWithSelectiveProps(\n 'Input',\n (value) => {\n if (isPlainObject(value) && hasProperty(value, 'type')) {\n switch (value.type) {\n case 'text':\n return TextInputPropsStruct;\n case 'password':\n return PasswordInputPropsStruct;\n case 'number':\n return NumberInputPropsStruct;\n default:\n return GenericInputPropsStruct;\n }\n }\n return GenericInputPropsStruct;\n },\n);\n\n/**\n * A struct for the {@link OptionElement} type.\n */\nexport const OptionStruct: Describe<OptionElement> = element('Option', {\n value: string(),\n children: string(),\n});\n\n/**\n * A struct for the {@link DropdownElement} type.\n */\nexport const DropdownStruct: Describe<DropdownElement> = element('Dropdown', {\n name: string(),\n value: optional(string()),\n children: children([OptionStruct]),\n});\n\n/**\n * A struct for the {@link AddressElement} type.\n */\nexport const AddressStruct: Describe<AddressElement> = element('Address', {\n address: nullUnion([HexChecksumAddressStruct, CaipAccountIdStruct]),\n truncate: optional(boolean()),\n displayName: optional(boolean()),\n avatar: optional(boolean()),\n});\n\n/**\n * A struct for the {@link CardElement} type.\n */\nexport const CardStruct: Describe<CardElement> = element('Card', {\n image: optional(string()),\n title: selectiveUnion((value) => {\n if (typeof value === 'object') {\n return AddressStruct;\n }\n return string();\n }),\n description: optional(string()),\n value: string(),\n extra: optional(string()),\n});\n\n/**\n * A struct for the {@link SelectorOptionElement} type.\n */\nexport const SelectorOptionStruct: Describe<SelectorOptionElement> = element(\n 'SelectorOption',\n {\n value: string(),\n children: CardStruct,\n },\n);\n\n/**\n * A struct for the {@link SelectorElement} type.\n */\nexport const SelectorStruct: Describe<SelectorElement> = element('Selector', {\n name: string(),\n title: string(),\n value: optional(string()),\n children: children([SelectorOptionStruct]),\n});\n\n/**\n * A struct for the {@link RadioElement} type.\n */\nexport const RadioStruct: Describe<RadioElement> = element('Radio', {\n value: string(),\n children: string(),\n});\n\n/**\n * A struct for the {@link RadioGroupElement} type.\n */\nexport const RadioGroupStruct: Describe<RadioGroupElement> = element(\n 'RadioGroup',\n {\n name: string(),\n value: optional(string()),\n children: children([RadioStruct]),\n },\n);\n\n/**\n * A struct for the {@link FileInputElement} type.\n */\nexport const FileInputStruct: Describe<FileInputElement> = element(\n 'FileInput',\n {\n name: string(),\n accept: nullUnion([optional(array(string()))]),\n compact: optional(boolean()),\n },\n);\n\n/**\n * A subset of JSX elements that represent the tuple Box + Input of the Field children.\n */\nconst BOX_INPUT_LEFT = [\n // eslint-disable-next-line @typescript-eslint/no-use-before-define\n singleChild(lazy(() => BoxChildStruct)),\n InputStruct,\n] as [typeof BoxChildStruct, typeof InputStruct];\n\n/**\n * A subset of JSX elements that represent the tuple Input + Box of the Field children.\n */\nconst BOX_INPUT_RIGHT = [\n InputStruct,\n // eslint-disable-next-line @typescript-eslint/no-use-before-define\n singleChild(lazy(() => BoxChildStruct)),\n] as [typeof InputStruct, typeof BoxChildStruct];\n\n/**\n * A subset of JSX elements that represent the tuple Box + Input + Box of the Field children.\n */\nconst BOX_INPUT_BOTH = [\n // eslint-disable-next-line @typescript-eslint/no-use-before-define\n singleChild(lazy(() => BoxChildStruct)),\n InputStruct,\n // eslint-disable-next-line @typescript-eslint/no-use-before-define\n singleChild(lazy(() => BoxChildStruct)),\n] as [typeof BoxChildStruct, typeof InputStruct, typeof BoxChildStruct];\n\n/**\n * A subset of JSX elements that are allowed as single children of the Field component.\n */\nconst FIELD_CHILDREN_ARRAY = [\n InputStruct,\n DropdownStruct,\n RadioGroupStruct,\n FileInputStruct,\n CheckboxStruct,\n SelectorStruct,\n] as [\n typeof InputStruct,\n typeof DropdownStruct,\n typeof RadioGroupStruct,\n typeof FileInputStruct,\n typeof CheckboxStruct,\n typeof SelectorStruct,\n];\n\n/**\n * A union of the allowed children of the Field component.\n * This is mainly used in the simulator for validation purposes.\n */\nexport const FieldChildUnionStruct = nullUnion([\n ...FIELD_CHILDREN_ARRAY,\n ...BOX_INPUT_LEFT,\n ...BOX_INPUT_RIGHT,\n ...BOX_INPUT_BOTH,\n]);\n\n/**\n * A subset of JSX elements that are allowed as children of the Field component.\n */\nconst FieldChildStruct = nullUnion([\n tuple(BOX_INPUT_LEFT),\n tuple(BOX_INPUT_RIGHT),\n tuple(BOX_INPUT_BOTH),\n ...FIELD_CHILDREN_ARRAY,\n]) as unknown as Struct<\n | [InputElement, GenericSnapChildren]\n | [GenericSnapChildren, InputElement]\n | [GenericSnapChildren, InputElement, GenericSnapChildren]\n | DropdownElement\n | RadioGroupElement\n | FileInputElement\n | InputElement\n | CheckboxElement\n | SelectorElement,\n null\n>;\n\n/**\n * A struct for the {@link FieldElement} type.\n */\nexport const FieldStruct: Describe<FieldElement> = element('Field', {\n label: optional(string()),\n error: optional(string()),\n children: FieldChildStruct,\n});\n\n/**\n * A subset of JSX elements that are allowed as children of the Form component.\n */\nexport const FormChildStruct = children(\n // eslint-disable-next-line @typescript-eslint/no-use-before-define\n [FieldStruct, lazy(() => BoxChildStruct)],\n) as unknown as Struct<SnapsChildren<GenericSnapElement>, null>;\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\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\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});\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 FileInputStruct,\n FormStruct,\n HeadingStruct,\n InputStruct,\n ImageStruct,\n ItalicStruct,\n LinkStruct,\n RowStruct,\n SpinnerStruct,\n TextStruct,\n TooltipStruct,\n CheckboxStruct,\n CardStruct,\n IconStruct,\n SelectorStruct,\n SectionStruct,\n AvatarStruct,\n]);\n\n/**\n * A struct for the {@link ContainerElement} type.\n */\nexport const ContainerStruct: Describe<ContainerElement> = element(\n 'Container',\n {\n children: selectiveUnion((value) => {\n if (Array.isArray(value)) {\n return tuple([BoxChildStruct, FooterStruct]);\n }\n return BoxChildStruct;\n }) as unknown as Struct<\n [GenericSnapElement, FooterElement] | GenericSnapElement,\n null\n >,\n },\n);\n\n/**\n * For now, the allowed JSX elements at the root are the same as the allowed\n * children of the Box component.\n */\nexport const RootJSXElementStruct = typedUnion([\n BoxChildStruct,\n ContainerStruct,\n]);\n\n/**\n * A struct for the {@link JSXElement} type.\n */\nexport const JSXElementStruct: Describe<JSXElement> = typedUnion([\n ButtonStruct,\n InputStruct,\n FileInputStruct,\n FieldStruct,\n FormStruct,\n BoldStruct,\n ItalicStruct,\n AddressStruct,\n BoxStruct,\n CopyableStruct,\n DividerStruct,\n HeadingStruct,\n ImageStruct,\n LinkStruct,\n RowStruct,\n SpinnerStruct,\n TextStruct,\n DropdownStruct,\n OptionStruct,\n RadioGroupStruct,\n RadioStruct,\n ValueStruct,\n TooltipStruct,\n CheckboxStruct,\n FooterStruct,\n ContainerStruct,\n CardStruct,\n IconStruct,\n SelectorStruct,\n SelectorOptionStruct,\n SectionStruct,\n AvatarStruct,\n]);\n\n/**\n * Check if a value is a JSX element.\n *\n * @param value - The value to check.\n * @returns True if the value is a JSX element, false otherwise.\n */\nexport function isJSXElement(value: unknown): value is JSXElement {\n return is(value, JSXElementStruct);\n}\n\n/**\n * Check if a value is a JSX element, without validating all of its contents.\n * This is useful when you want to validate the structure of a value, but not\n * all the children.\n *\n * This should only be used when you are sure that the value is safe to use,\n * i.e., after using {@link isJSXElement}.\n *\n * @param value - The value to check.\n * @returns True if the value is a JSX element, false otherwise.\n */\nexport function isJSXElementUnsafe(value: unknown): value is JSXElement {\n return (\n isPlainObject(value) &&\n hasProperty(value, 'type') &&\n hasProperty(value, 'props') &&\n hasProperty(value, 'key')\n );\n}\n\n/**\n * Assert that a value is a JSX element.\n *\n * @param value - The value to check.\n * @throws If the value is not a JSX element.\n */\nexport function assertJSXElement(value: unknown): asserts value is JSXElement {\n // TODO: We should use the error parsing utils from `snaps-utils` to improve\n // the error messages. It currently includes colours and potentially other\n // formatting that we might not want to include in the SDK.\n if (!isJSXElement(value)) {\n throw new Error(\n `Expected a JSX element, but received ${JSON.stringify(\n value,\n )}. Please refer to the documentation for the supported JSX elements and their props.`,\n );\n }\n}\n"]}
1
+ {"version":3,"file":"validation.cjs","sourceRoot":"","sources":["../../src/jsx/validation.ts"],"names":[],"mappings":";;;;AAOA,uDAe+B;AAC/B,2CAMyB;AAGzB,sDAMsB;AAatB,uDAoCsB;AAEtB;;GAEG;AACU,QAAA,SAAS,GAAkB,IAAA,qBAAS,EAAC,CAAC,IAAA,oBAAM,GAAE,EAAE,IAAA,oBAAM,GAAE,CAAC,CAAC,CAAC;AAExE;;GAEG;AACU,QAAA,mBAAmB,GAA4B,QAAQ,CAAC;IACnE,IAAA,oBAAM,GAAE;CACT,CAAC,CAAC;AAEH;;GAEG;AACU,QAAA,aAAa,GAAiC,IAAA,oBAAM,EAAC;IAChE,IAAI,EAAE,IAAA,oBAAM,GAAE;I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AAC,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 ValueElement} type.\n */\nexport const ValueStruct: Describe<ValueElement> = element('Value', {\n value: string(),\n extra: string(),\n});\n\n/**\n * A struct for the {@link HeadingElement} type.\n */\nexport const HeadingStruct: Describe<HeadingElement> = element('Heading', {\n children: StringElementStruct,\n size: optional(nullUnion([literal('sm'), literal('md'), literal('lg')])),\n});\n\n/**\n * A struct for the {@link LinkElement} type.\n */\nexport const LinkStruct: Describe<LinkElement> = element('Link', {\n href: string(),\n children: children([\n FormattingStruct,\n string(),\n IconStruct,\n ImageStruct,\n AddressStruct,\n ]),\n});\n\n/**\n * A struct for the {@link TextElement} type.\n */\nexport const TextStruct: Describe<TextElement> = element('Text', {\n children: children([\n selectiveUnion((value) => {\n if (typeof value === 'string') {\n return string();\n }\n return typedUnion([BoldStruct, ItalicStruct, LinkStruct, IconStruct]);\n }),\n ]),\n alignment: optional(\n nullUnion([literal('start'), literal('center'), literal('end')]),\n ),\n color: optional(\n nullUnion([\n literal('default'),\n literal('alternative'),\n literal('muted'),\n literal('error'),\n literal('success'),\n literal('warning'),\n ]),\n ),\n size: optional(nullUnion([literal('sm'), literal('md')])),\n fontWeight: optional(\n nullUnion([literal('regular'), literal('medium'), literal('bold')]),\n ),\n});\n\n/**\n * A subset of JSX elements that are allowed as children of the Tooltip component.\n * This set should include all text components and the Image.\n */\nexport const TooltipChildStruct = selectiveUnion((value) => {\n if (typeof value === 'boolean') {\n return boolean();\n }\n return typedUnion([\n TextStruct,\n BoldStruct,\n ItalicStruct,\n LinkStruct,\n ImageStruct,\n IconStruct,\n ]);\n});\n\n/**\n * A subset of JSX elements that are allowed as content of the Tooltip component.\n * This set should include all text components.\n */\nexport const TooltipContentStruct = selectiveUnion((value) => {\n if (typeof value === 'string') {\n return string();\n }\n return typedUnion([\n TextStruct,\n BoldStruct,\n ItalicStruct,\n LinkStruct,\n IconStruct,\n ]);\n});\n\n/**\n * A struct for the {@link TooltipElement} type.\n */\nexport const TooltipStruct: Describe<TooltipElement> = element('Tooltip', {\n children: nullable(TooltipChildStruct),\n content: TooltipContentStruct,\n});\n\n/**\n * A struct for the {@link BannerElement} type.\n */\nexport const BannerStruct: Describe<BannerElement> = element('Banner', {\n children: children([\n TextStruct,\n LinkStruct,\n IconStruct,\n ButtonStruct,\n BoldStruct,\n ItalicStruct,\n ]),\n title: string(),\n severity: union([\n literal('danger'),\n literal('info'),\n literal('success'),\n literal('warning'),\n ]),\n});\n\n/**\n * A struct for the {@link RowElement} type.\n */\nexport const RowStruct: Describe<RowElement> = element('Row', {\n label: string(),\n children: typedUnion([\n AddressStruct,\n ImageStruct,\n TextStruct,\n ValueStruct,\n LinkStruct,\n ]),\n variant: optional(\n nullUnion([literal('default'), literal('warning'), literal('critical')]),\n ),\n tooltip: optional(string()),\n});\n\n/**\n * A struct for the {@link SpinnerElement} type.\n */\nexport const SpinnerStruct: Describe<SpinnerElement> = element('Spinner');\n\n/**\n * A subset of JSX elements that are allowed as children of the Box component.\n * This set includes all components, except components that need to be nested in\n * another component (e.g., Field must be contained in a Form).\n */\nexport const BoxChildStruct = typedUnion([\n AddressStruct,\n BoldStruct,\n BoxStruct,\n ButtonStruct,\n CopyableStruct,\n DividerStruct,\n DropdownStruct,\n RadioGroupStruct,\n FieldStruct,\n FileInputStruct,\n FormStruct,\n HeadingStruct,\n InputStruct,\n ImageStruct,\n ItalicStruct,\n LinkStruct,\n RowStruct,\n SpinnerStruct,\n TextStruct,\n TooltipStruct,\n CheckboxStruct,\n CardStruct,\n IconStruct,\n SelectorStruct,\n SectionStruct,\n AvatarStruct,\n BannerStruct,\n]);\n\n/**\n * A struct for the {@link ContainerElement} type.\n */\nexport const ContainerStruct: Describe<ContainerElement> = element(\n 'Container',\n {\n children: selectiveUnion((value) => {\n if (Array.isArray(value)) {\n return tuple([BoxChildStruct, FooterStruct]);\n }\n return BoxChildStruct;\n }) as unknown as Struct<\n [GenericSnapElement, FooterElement] | GenericSnapElement,\n null\n >,\n },\n);\n\n/**\n * For now, the allowed JSX elements at the root are the same as the allowed\n * children of the Box component.\n */\nexport const RootJSXElementStruct = typedUnion([\n BoxChildStruct,\n ContainerStruct,\n]);\n\n/**\n * A struct for the {@link JSXElement} type.\n */\nexport const JSXElementStruct: Describe<JSXElement> = typedUnion([\n ButtonStruct,\n InputStruct,\n FileInputStruct,\n FieldStruct,\n FormStruct,\n BoldStruct,\n ItalicStruct,\n AddressStruct,\n BoxStruct,\n CopyableStruct,\n DividerStruct,\n HeadingStruct,\n ImageStruct,\n LinkStruct,\n RowStruct,\n SpinnerStruct,\n TextStruct,\n DropdownStruct,\n OptionStruct,\n RadioGroupStruct,\n RadioStruct,\n ValueStruct,\n TooltipStruct,\n CheckboxStruct,\n FooterStruct,\n ContainerStruct,\n CardStruct,\n IconStruct,\n SelectorStruct,\n SelectorOptionStruct,\n SectionStruct,\n AvatarStruct,\n BannerStruct,\n]);\n\n/**\n * Check if a value is a JSX element.\n *\n * @param value - The value to check.\n * @returns True if the value is a JSX element, false otherwise.\n */\nexport function isJSXElement(value: unknown): value is JSXElement {\n return is(value, JSXElementStruct);\n}\n\n/**\n * Check if a value is a JSX element, without validating all of its contents.\n * This is useful when you want to validate the structure of a value, but not\n * all the children.\n *\n * This should only be used when you are sure that the value is safe to use,\n * i.e., after using {@link isJSXElement}.\n *\n * @param value - The value to check.\n * @returns True if the value is a JSX element, false otherwise.\n */\nexport function isJSXElementUnsafe(value: unknown): value is JSXElement {\n return (\n isPlainObject(value) &&\n hasProperty(value, 'type') &&\n hasProperty(value, 'props') &&\n hasProperty(value, 'key')\n );\n}\n\n/**\n * Assert that a value is a JSX element.\n *\n * @param value - The value to check.\n * @throws If the value is not a JSX element.\n */\nexport function assertJSXElement(value: unknown): asserts value is JSXElement {\n // TODO: We should use the error parsing utils from `snaps-utils` to improve\n // the error messages. It currently includes colours and potentially other\n // formatting that we might not want to include in the SDK.\n if (!isJSXElement(value)) {\n throw new Error(\n `Expected a JSX element, but received ${JSON.stringify(\n value,\n )}. Please refer to the documentation for the supported JSX elements and their props.`,\n );\n }\n}\n"]}