Skip to content
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
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": "t/mItLdi/miIU7FWJjijmmaFT/5svN1dK4Ik+1LMbqw=",
"shasum": "d0Rvxg6jxAfVxcrMdk2xdJOL7oDh74YKzhvRD2/Gs/s=",
"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": "3kC/z0z6RjjarArtxcs+iltJRQgvZNIPBueMP0cLQJw=",
"shasum": "Oy5sCDh6f5WVjosPyzy5U70omD4/SI1WHwOBSmH6Zr8=",
"location": {
"npm": {
"filePath": "dist/bundle.js",
Expand Down
7 changes: 6 additions & 1 deletion packages/snaps-sdk/src/jsx/components/Box.test.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,11 @@ describe('Box', () => {

it('renders a box with props', () => {
const result = (
<Box direction="horizontal" alignment="space-between">
<Box
direction="horizontal"
alignment="space-between"
crossAlignment="center"
>
<Text>Hello</Text>
<Text>World</Text>
</Box>
Expand All @@ -70,6 +74,7 @@ describe('Box', () => {
props: {
direction: 'horizontal',
alignment: 'space-between',
crossAlignment: 'center',
children: [
{
type: 'Text',
Expand Down
2 changes: 2 additions & 0 deletions packages/snaps-sdk/src/jsx/components/Box.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ import { createSnapComponent } from '../component';
* @property children - The children of the box.
* @property direction - The direction to stack the components within the box. Defaults to `vertical`.
* @property alignment - The alignment mode to use within the box. Defaults to `start`.
* @property crossAlignment - The cross alignment mode to use within the box. Defaults to `start`.
* @property center - Whether to center the children within the box. Defaults to `false`.
*/
export type BoxProps = {
Expand All @@ -20,6 +21,7 @@ export type BoxProps = {
| 'space-between'
| 'space-around'
| undefined;
crossAlignment?: 'start' | 'center' | 'end';
center?: boolean | undefined;
};

Expand Down
6 changes: 5 additions & 1 deletion packages/snaps-sdk/src/jsx/validation.test.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -589,7 +589,7 @@ describe('BoxStruct', () => {
<Image src="<svg />" alt="alt" />
</Row>
</Box>,
<Box direction="horizontal" alignment="space-between">
<Box direction="horizontal" alignment="space-between" crossAlignment="end">
<Text>foo</Text>
<Row label="label">
<Image src="<svg />" alt="alt" />
Expand Down Expand Up @@ -636,6 +636,10 @@ describe('BoxStruct', () => {
<Image src="<svg />" alt="alt" />
</Row>
</Box>,
// @ts-expect-error - Invalid props.
<Box crossAlignment="bar">
<Text>foo</Text>
</Box>,
<Box>
<Value extra="foo" value="bar" />
</Box>,
Expand Down
3 changes: 3 additions & 0 deletions packages/snaps-sdk/src/jsx/validation.ts
Original file line number Diff line number Diff line change
Expand Up @@ -596,6 +596,9 @@ export const BoxStruct: Describe<BoxElement> = element('Box', {
literal('space-around'),
]),
),
crossAlignment: optional(
nullUnion([literal('start'), literal('center'), literal('end')]),
),
center: optional(boolean()),
});

Expand Down
Loading