Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: Allow row tooltips #2483

Merged
merged 3 commits into from
Jun 12, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion packages/examples/packages/bip32/snap.manifest.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
"url": "https://github.com/MetaMask/snaps.git"
},
"source": {
"shasum": "TREcufYIoY7V4COT/nD1zIpokLo0q6/cerUCNr4lt3o=",
"shasum": "m534qYi/XgCxoRE4vFgV1lXgrnYeTCpJeG++gGXthMI=",
"location": {
"npm": {
"filePath": "dist/bundle.js",
Expand Down
2 changes: 1 addition & 1 deletion packages/examples/packages/bip44/snap.manifest.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
"url": "https://github.com/MetaMask/snaps.git"
},
"source": {
"shasum": "axLG/VQvjzujN4JseNaabRFWTnzIGFL51wtMfmZzBUw=",
"shasum": "qsn0aZs/dUcVkIDJqBdrUS4PQUZdxl5U+yXgzXunY94=",
"location": {
"npm": {
"filePath": "dist/bundle.js",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
"url": "https://github.com/MetaMask/snaps.git"
},
"source": {
"shasum": "dycI4lCR5jpi1mLldxpY8BgAxxj6UryoHM0T1AYVENo=",
"shasum": "8vhRM3+4qtu3k6W5vZvWkuQXqXlNKbHwAhEzzEsUwHU=",
"location": {
"npm": {
"filePath": "dist/bundle.js",
Expand Down
2 changes: 1 addition & 1 deletion packages/examples/packages/browserify/snap.manifest.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
"url": "https://github.com/MetaMask/snaps.git"
},
"source": {
"shasum": "GEqBpbhYJXsEPECq0Bxb0V0bVfSvZnj+qIG4hl3FlsI=",
"shasum": "usvFzN09f2l10Zjk/7OhFl0i851kNH3lOYj7+JhDYeY=",
"location": {
"npm": {
"filePath": "dist/bundle.js",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
"url": "https://github.com/MetaMask/snaps.git"
},
"source": {
"shasum": "0WWLwzj9HnugnEddfjUAUSh8kx5DcEsVs7ap+nRsCDw=",
"shasum": "INNGJezYrSDbp/lkANrW/7ydAoXGjIZbLKW44hjSL1c=",
"location": {
"npm": {
"filePath": "dist/bundle.js",
Expand Down
2 changes: 1 addition & 1 deletion packages/examples/packages/cronjobs/snap.manifest.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
"url": "https://github.com/MetaMask/snaps.git"
},
"source": {
"shasum": "CQhtA/Opsgaigfqzw8NtDMjIndQCdEvOZW47ZvHQJII=",
"shasum": "GSSdbj7tOl5BI/zCUCWHnBBh7d+jDthFLImX8zoBCbE=",
"location": {
"npm": {
"filePath": "dist/bundle.js",
Expand Down
2 changes: 1 addition & 1 deletion packages/examples/packages/dialogs/snap.manifest.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
"url": "https://github.com/MetaMask/snaps.git"
},
"source": {
"shasum": "xUu7RSZGKNAImcNc4ZGGn6UmgX2kdqnOd9Gse1+JCcM=",
"shasum": "jJ827B8WyucghCYg6GdADMetSqCHG1bcc69J15pG1yc=",
"location": {
"npm": {
"filePath": "dist/bundle.js",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
"url": "https://github.com/MetaMask/snaps.git"
},
"source": {
"shasum": "p1nV1fdVB82jnbDgzKOabh2IGPqPG49N+Nfv2txeBJE=",
"shasum": "XeRKT1KZyxC7FoxhglQri2n5tzTGaeVkumNRL8dFmX8=",
"location": {
"npm": {
"filePath": "dist/bundle.js",
Expand Down
2 changes: 1 addition & 1 deletion packages/examples/packages/ethers-js/snap.manifest.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
"url": "https://github.com/MetaMask/snaps.git"
},
"source": {
"shasum": "deferGQ6r4/vHiVAduQ9Fhh0SOH/nIz31mwNomgepMQ=",
"shasum": "rlCs4sFFfjx2/jKHvQZZj8EXbxKvoTNg+XJXuC0OBso=",
"location": {
"npm": {
"filePath": "dist/bundle.js",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
"url": "https://github.com/MetaMask/snaps.git"
},
"source": {
"shasum": "6XLOSwQPskllwqdiUrslKpJ9nCbbx+XRpnMIlo23Wi8=",
"shasum": "ninTM4hA+ZfBMd1NyE5kwk6A9QLTDzHdIbq5fsuwiHg=",
"location": {
"npm": {
"filePath": "dist/bundle.js",
Expand Down
2 changes: 1 addition & 1 deletion packages/examples/packages/get-file/snap.manifest.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
"url": "https://github.com/MetaMask/snaps.git"
},
"source": {
"shasum": "eptn/xIgVjhxWY3NIf/DP3NIIPAAsn3/6NHkbMAfC2g=",
"shasum": "WF57L3AOwWUawv695Kqjwhq2OlIpno7KAYTxvpQ5Lmw=",
"location": {
"npm": {
"filePath": "dist/bundle.js",
Expand Down
2 changes: 1 addition & 1 deletion packages/examples/packages/home-page/snap.manifest.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
"url": "https://github.com/MetaMask/snaps.git"
},
"source": {
"shasum": "UhaDba6hRYQAHFBKsSDAgWMQT5s6auMoqjF2NVkacMQ=",
"shasum": "RY+rMJcEl/XnmeffViFape1SBJhD98LvO6BG9kYUj+k=",
"location": {
"npm": {
"filePath": "dist/bundle.js",
Expand Down
2 changes: 1 addition & 1 deletion packages/examples/packages/images/snap.manifest.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
"url": "https://github.com/MetaMask/snaps.git"
},
"source": {
"shasum": "gVDy77ndUwHXMHKAEaKbB93UEmQK8AhRgchgCL4OgvM=",
"shasum": "wH0gEOfFOoRbk6CnXPmPx/ZG/WKozq2a1IYRMsonryk=",
"location": {
"npm": {
"filePath": "dist/bundle.js",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
"url": "https://github.com/MetaMask/snaps.git"
},
"source": {
"shasum": "lH/znLCS8awZJFD2rzWUiOqg2JzzBoYPGcnaQPAEf9c=",
"shasum": "+BZjKNAin4KDTOiqUFdln/sU8XvRNylsSD63pZ9DZgM=",
"location": {
"npm": {
"filePath": "dist/bundle.js",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
"url": "https://github.com/MetaMask/snaps.git"
},
"source": {
"shasum": "FB0Awqlq29qSAlnhts8fFOSNaLoy7CBdbtDxYjyuwP8=",
"shasum": "ZKmCHrMsYtL7qqYYiYdhyJ6cSGQpn/IMRAvSp2XQP7k=",
"location": {
"npm": {
"filePath": "dist/bundle.js",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
"url": "https://github.com/MetaMask/snaps.git"
},
"source": {
"shasum": "T9mf3EkRNjEvSSytsSkziPFe8kG7QcIQ1Fgb0zAwKuA=",
"shasum": "/xrkYe6ggWvH40bytUvTG+B2iR7z2xTR6jr0xCJ9TnA=",
"location": {
"npm": {
"filePath": "dist/bundle.js",
Expand Down
2 changes: 1 addition & 1 deletion packages/examples/packages/json-rpc/snap.manifest.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
"url": "https://github.com/MetaMask/snaps.git"
},
"source": {
"shasum": "f3FqSG4N7wHsrk2pqfpavrwuV0rHx6nifS8nyWPH87Y=",
"shasum": "Y5AZFL08UGh5nM8m/oi3/kt3qOVW4fgyjudy61jJU2c=",
"location": {
"npm": {
"filePath": "dist/bundle.js",
Expand Down
2 changes: 1 addition & 1 deletion packages/examples/packages/jsx/snap.manifest.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
"url": "https://github.com/MetaMask/snaps.git"
},
"source": {
"shasum": "lvTk/xCi7Ivz7sv6hTlxb71JyEv4Jr0m5cUnL2lqb0Y=",
"shasum": "rQwGWqV0U0QhNO31NOelIGYl3PQKux4FBSvYoa6qAQc=",
"location": {
"npm": {
"filePath": "dist/bundle.js",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
"url": "https://github.com/MetaMask/snaps.git"
},
"source": {
"shasum": "RHHnf+vaMAIsO2DNHCDW8u+ZXm0wealMt3ezFA6Kr5U=",
"shasum": "AJLrq/+sBh2CcXSlkq8abgrpQTx82IRFPPoEd7pMGuE=",
"location": {
"npm": {
"filePath": "dist/bundle.js",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
"url": "https://github.com/MetaMask/snaps.git"
},
"source": {
"shasum": "t52hDXmDW8NBcLMWMXVeeDomXJb4m0m5x5zf86+KOFE=",
"shasum": "e3+BzxCOIxD7Ge6bfbOVfYn8qAgJGjX2ptbbIcK01Xg=",
"location": {
"npm": {
"filePath": "dist/bundle.js",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
"url": "https://github.com/MetaMask/snaps.git"
},
"source": {
"shasum": "dMi1L4ApZ05tju3n3hf5bm5pTNRehoshuHX0qwazIHo=",
"shasum": "AZri1Pta5Hb2tKLBFDszJlkGcqGkk8ucv8HeYpsmwIA=",
"location": {
"npm": {
"filePath": "dist/bundle.js",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
"url": "https://github.com/MetaMask/snaps.git"
},
"source": {
"shasum": "GVOl3/uYRKIlCZ0QbKgmxIfwKcNH+uUxo9ebkAzJEgY=",
"shasum": "ytDZYJr3F7NsaxV7XIWsTkXpoxLVwBjKm64OTV3t06s=",
"location": {
"npm": {
"filePath": "dist/bundle.js",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
"url": "https://github.com/MetaMask/snaps.git"
},
"source": {
"shasum": "COKBZnHBYfy9It8WpfKuDvQCSzHgznINwo72GWWkLgE=",
"shasum": "duYiAbBLBLIj7BZLCJssKwlDXF2D411Cu/7qw978NWk=",
"location": {
"npm": {
"filePath": "dist/bundle.js",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
"url": "https://github.com/MetaMask/snaps.git"
},
"source": {
"shasum": "imIhvBYiRYBYzCi9UDoAWBec44ZBwnjjENam483eEPM=",
"shasum": "0kIdLWEd22s28BwqHKDbz6d82hEQmfN53PNLt1gIeIc=",
"location": {
"npm": {
"filePath": "dist/bundle.js",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
"url": "https://github.com/MetaMask/snaps.git"
},
"source": {
"shasum": "GWEBRZ7ZyU5HzrK6PDvUoMfPwpd3TcHp6+mKYkV3tp0=",
"shasum": "DzJFebhj7CZv7Mn++/G9uSeDjYgTOVSUdq7sBDwNvOk=",
"location": {
"npm": {
"filePath": "dist/bundle.js",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
"url": "https://github.com/MetaMask/snaps.git"
},
"source": {
"shasum": "B8wUlC0JI9qbMmXTYEaQcjIi616AGhx7071cjvT0X8s=",
"shasum": "NcGYsp8dE2bmD6Zn0nQ43J3GLZCQPw6Jb5jLeEcw+ak=",
"location": {
"npm": {
"filePath": "dist/bundle.js",
Expand Down
2 changes: 1 addition & 1 deletion packages/examples/packages/wasm/snap.manifest.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
"url": "https://github.com/MetaMask/snaps.git"
},
"source": {
"shasum": "FMlZgAdgCuy+jMu06p2YvuuIXapAEGFJ0GVU9wT5N44=",
"shasum": "Lab+FwniA9wQTm/b9m3Ub07AneVO5BQzl/m65uxjso0=",
"location": {
"npm": {
"filePath": "dist/bundle.js",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
"url": "https://github.com/MetaMask/snaps.git"
},
"source": {
"shasum": "fbnX8p86k3qL9MBMCWk2fwPlKw2DDkfkVqaJtH5Q2IY=",
"shasum": "cbpitk6uFzdy2tnlRruUz/I4nXw2mpZCt+2UHQa2efg=",
"location": {
"npm": {
"filePath": "dist/bundle.js",
Expand Down
5 changes: 4 additions & 1 deletion packages/snaps-sdk/src/jsx/components/Row.ts
Original file line number Diff line number Diff line change
Expand Up @@ -20,11 +20,13 @@ export type RowChildren =
* @property children - The content of the row. This can be an address, an
* image, or text.
* @property variant - The variant of the row.
* @property tooltip - An optional tooltip to show for the row.
*/
export type RowProps = {
label: string;
children: RowChildren;
variant?: 'default' | 'warning' | 'error';
tooltip?: string | undefined;
};

const TYPE = 'Row';
Expand All @@ -37,9 +39,10 @@ const TYPE = 'Row';
* @param props.children - The content of the row. This can be an address, an
* image, or text.
* @param props.variant - The variant of the row.
* @param props.tooltip - An optional tooltip to show for the row.
* @returns A row element.
* @example
* <Row label="From" variant="warning">
* <Row label="From" variant="warning" tooltip="This address has been deemed dangerous.">
* <Address address="0x1234567890123456789012345678901234567890" />
* </Row>
*/
Expand Down
3 changes: 3 additions & 0 deletions packages/snaps-sdk/src/jsx/validation.test.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -693,6 +693,9 @@ describe('RowStruct', () => {
<Row label="label" variant="default">
<Value extra="foo" value="bar" />
</Row>,
<Row label="label" variant="default" tooltip="This is a tooltip.">
<Value extra="foo" value="bar" />
</Row>,
])('validates a row element', (value) => {
expect(is(value, RowStruct)).toBe(true);
});
Expand Down
1 change: 1 addition & 0 deletions packages/snaps-sdk/src/jsx/validation.ts
Original file line number Diff line number Diff line change
Expand Up @@ -311,6 +311,7 @@ export const RowStruct: Describe<RowElement> = element('Row', {
variant: optional(
nullUnion([literal('default'), literal('warning'), literal('error')]),
),
tooltip: optional(string()),
});

/**
Expand Down
Loading