diff --git a/packages/examples/packages/bip32/snap.manifest.json b/packages/examples/packages/bip32/snap.manifest.json index 013b22afae..9cbaeafd76 100644 --- a/packages/examples/packages/bip32/snap.manifest.json +++ b/packages/examples/packages/bip32/snap.manifest.json @@ -7,7 +7,7 @@ "url": "https://github.com/MetaMask/snaps.git" }, "source": { - "shasum": "o0r7dTMBgRTsatqWC09DllWt7iKawEfT+UEYJyPvpjw=", + "shasum": "dWCQ3BjoAmv1KlzbrNPRa4QlB3qSHQKL6ONaV0mo7b0=", "location": { "npm": { "filePath": "dist/bundle.js", diff --git a/packages/examples/packages/bip44/snap.manifest.json b/packages/examples/packages/bip44/snap.manifest.json index 6dc4e85144..a447a18fed 100644 --- a/packages/examples/packages/bip44/snap.manifest.json +++ b/packages/examples/packages/bip44/snap.manifest.json @@ -7,7 +7,7 @@ "url": "https://github.com/MetaMask/snaps.git" }, "source": { - "shasum": "+nueF506YIHiz6om1Qozd92BRpO3qs17joFO+0sUr/Y=", + "shasum": "dqWYaxXKggEChwefUCTvipvNzQ+0KbaT6x8vRDW0miw=", "location": { "npm": { "filePath": "dist/bundle.js", diff --git a/packages/examples/packages/browserify-plugin/snap.manifest.json b/packages/examples/packages/browserify-plugin/snap.manifest.json index 74fa283d77..4fa97b9011 100644 --- a/packages/examples/packages/browserify-plugin/snap.manifest.json +++ b/packages/examples/packages/browserify-plugin/snap.manifest.json @@ -7,7 +7,7 @@ "url": "https://github.com/MetaMask/snaps.git" }, "source": { - "shasum": "w8ZPchwG+LqlFzbmkqVQ5nDqt5GDFkZsU8dUm1b5NXo=", + "shasum": "lyy+HECzOFQzuzjyD1nas6GPc4kMt340ChbqQZl7uEo=", "location": { "npm": { "filePath": "dist/bundle.js", diff --git a/packages/examples/packages/browserify/snap.manifest.json b/packages/examples/packages/browserify/snap.manifest.json index 7bac25832c..f21cb160da 100644 --- a/packages/examples/packages/browserify/snap.manifest.json +++ b/packages/examples/packages/browserify/snap.manifest.json @@ -7,7 +7,7 @@ "url": "https://github.com/MetaMask/snaps.git" }, "source": { - "shasum": "tkxfxAjBgF7nF6SvHC4M7Q0srVnLsPuk23aJoh/dsFI=", + "shasum": "k7NYoT8jI2E4u785PN5PoruwtjF18KNOSagNY9fS44U=", "location": { "npm": { "filePath": "dist/bundle.js", diff --git a/packages/examples/packages/cronjobs/snap.manifest.json b/packages/examples/packages/cronjobs/snap.manifest.json index 535d0df9f1..c4d4627c79 100644 --- a/packages/examples/packages/cronjobs/snap.manifest.json +++ b/packages/examples/packages/cronjobs/snap.manifest.json @@ -7,7 +7,7 @@ "url": "https://github.com/MetaMask/snaps.git" }, "source": { - "shasum": "CEewtsiFdgFdhRMjCUJX6/1q+AW3EEHIg+KsCDGe++U=", + "shasum": "8bB9qcVDzKQyefr78Cm03aTbojKKg5jQ4nkzZUccKhs=", "location": { "npm": { "filePath": "dist/bundle.js", diff --git a/packages/examples/packages/dialogs/snap.manifest.json b/packages/examples/packages/dialogs/snap.manifest.json index 57a8738890..263fc2f1ef 100644 --- a/packages/examples/packages/dialogs/snap.manifest.json +++ b/packages/examples/packages/dialogs/snap.manifest.json @@ -7,7 +7,7 @@ "url": "https://github.com/MetaMask/snaps.git" }, "source": { - "shasum": "/EeoYCNi7wEoA/1FrpL1FIi/qyYmgUNMKSj1kVbVgQk=", + "shasum": "uZhYG9+3b1yA/94e0QhCJycqrPA96cBQyP+2plF0SEg=", "location": { "npm": { "filePath": "dist/bundle.js", diff --git a/packages/examples/packages/ethers-js/snap.manifest.json b/packages/examples/packages/ethers-js/snap.manifest.json index e10d48ff02..4c2b8ee23f 100644 --- a/packages/examples/packages/ethers-js/snap.manifest.json +++ b/packages/examples/packages/ethers-js/snap.manifest.json @@ -7,7 +7,7 @@ "url": "https://github.com/MetaMask/snaps.git" }, "source": { - "shasum": "nDlAQQY2l0vn9krd3F0EMJWpgKtUGrA7OPcLdXLd1iA=", + "shasum": "uVLwzYliwDATW6CiqATb1FyPgyagNs+3ini7QA+0okc=", "location": { "npm": { "filePath": "dist/bundle.js", diff --git a/packages/examples/packages/get-entropy/snap.manifest.json b/packages/examples/packages/get-entropy/snap.manifest.json index 18fbc63a4d..919d14e3b1 100644 --- a/packages/examples/packages/get-entropy/snap.manifest.json +++ b/packages/examples/packages/get-entropy/snap.manifest.json @@ -7,7 +7,7 @@ "url": "https://github.com/MetaMask/snaps.git" }, "source": { - "shasum": "U+a7ZNEVnChJYWtX9A2s92XLDL4fIGfz+HWTTjDpM+E=", + "shasum": "1jPm8koZvt+Tme7DCtogqKfS+fR4SJnPU7N8r85ku1Y=", "location": { "npm": { "filePath": "dist/bundle.js", diff --git a/packages/examples/packages/images/snap.manifest.json b/packages/examples/packages/images/snap.manifest.json index bf32a98bda..92dfd5f381 100644 --- a/packages/examples/packages/images/snap.manifest.json +++ b/packages/examples/packages/images/snap.manifest.json @@ -7,7 +7,7 @@ "url": "https://github.com/MetaMask/snaps.git" }, "source": { - "shasum": "/FySWBXQTwZgrpkIHPWb/0Q+k3fBWmKL41u0dZaV5O0=", + "shasum": "PWtPR8sJIxj/6B8eLRvGjndi5udmdlWu6eKP4QWFOXg=", "location": { "npm": { "filePath": "dist/bundle.js", diff --git a/packages/examples/packages/invoke-snap/packages/core-signer/snap.manifest.json b/packages/examples/packages/invoke-snap/packages/core-signer/snap.manifest.json index da8260aeb4..4d165f5d88 100644 --- a/packages/examples/packages/invoke-snap/packages/core-signer/snap.manifest.json +++ b/packages/examples/packages/invoke-snap/packages/core-signer/snap.manifest.json @@ -7,7 +7,7 @@ "url": "https://github.com/MetaMask/snaps.git" }, "source": { - "shasum": "RptJSWpO9h8t3X7kxCq7spXzP2xWqw6ype4+StKyZNQ=", + "shasum": "QPxHqRPygXB1Z6M4XreZtw/im8wCEBJgEtLdkOtwob8=", "location": { "npm": { "filePath": "dist/bundle.js", diff --git a/packages/examples/packages/signature-insights/snap.manifest.json b/packages/examples/packages/signature-insights/snap.manifest.json index 7263213b76..9b58dec76f 100644 --- a/packages/examples/packages/signature-insights/snap.manifest.json +++ b/packages/examples/packages/signature-insights/snap.manifest.json @@ -7,7 +7,7 @@ "url": "https://github.com/MetaMask/snaps.git" }, "source": { - "shasum": "f9c70KMplhX7bQunGJ9fom0KVBUePVz+B2v+AkdImRc=", + "shasum": "W7760+wNYB7ikWVHQeEx5IRAt+Q07Cq4zaYwmfCEqr8=", "location": { "npm": { "filePath": "dist/bundle.js", diff --git a/packages/examples/packages/transaction-insights/snap.manifest.json b/packages/examples/packages/transaction-insights/snap.manifest.json index 19dbbf60a3..e9aeffda81 100644 --- a/packages/examples/packages/transaction-insights/snap.manifest.json +++ b/packages/examples/packages/transaction-insights/snap.manifest.json @@ -7,7 +7,7 @@ "url": "https://github.com/MetaMask/snaps.git" }, "source": { - "shasum": "G1B2zhWBAKG5KuzKgWcyPEYlAd1KSdD5ydBjiQq2NSg=", + "shasum": "FxEMWKtdMuijdmu4neAmXosp1zIiuvwzngv7U6t9eC4=", "location": { "npm": { "filePath": "dist/bundle.js", diff --git a/packages/snaps-sdk/src/jsx/components/form/Button.test.tsx b/packages/snaps-sdk/src/jsx/components/form/Button.test.tsx index 2a1ef1f0d7..ea2238ee08 100644 --- a/packages/snaps-sdk/src/jsx/components/form/Button.test.tsx +++ b/packages/snaps-sdk/src/jsx/components/form/Button.test.tsx @@ -63,4 +63,23 @@ describe('Button', () => { key: null, }); }); + + it('returns a button element with a variant and loading state', () => { + const result = ( + + ); + + expect(result).toStrictEqual({ + type: 'Button', + props: { + children: 'foo', + type: 'button', + variant: 'primary', + loading: true, + }, + key: null, + }); + }); }); diff --git a/packages/snaps-sdk/src/jsx/components/form/Button.ts b/packages/snaps-sdk/src/jsx/components/form/Button.ts index 67a5dd2c72..ffb89801b8 100644 --- a/packages/snaps-sdk/src/jsx/components/form/Button.ts +++ b/packages/snaps-sdk/src/jsx/components/form/Button.ts @@ -16,14 +16,16 @@ import type { ImageElement } from '../Image'; * @property variant - The variant of the button, i.e., `'primary'` or * `'destructive'`. Defaults to `'primary'`. * @property disabled - Whether the button is disabled. Defaults to `false`. + * @property loading - Whether the button is in loading state. Defaults to `false`. * @property form - The name of the form component to associate the button with. */ export type ButtonProps = { children: SnapsChildren; name?: string | undefined; type?: 'button' | 'submit' | undefined; - variant?: 'primary' | 'destructive' | 'loading' | undefined; + variant?: 'primary' | 'destructive' | undefined; disabled?: boolean | undefined; + loading?: boolean | undefined; form?: string | undefined; }; diff --git a/packages/snaps-sdk/src/jsx/validation.test.tsx b/packages/snaps-sdk/src/jsx/validation.test.tsx index 46fc4fd39b..60466eadbf 100644 --- a/packages/snaps-sdk/src/jsx/validation.test.tsx +++ b/packages/snaps-sdk/src/jsx/validation.test.tsx @@ -163,8 +163,10 @@ describe('ButtonStruct', () => { , , , - , , + , ,