Skip to content
Draft
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
@@ -1,11 +1,10 @@
import { BannerAlertSeverity } from '@metamask/design-system-shared';

import {
BannerAlertSeverity,
BoxBackgroundColor,
BoxBorderColor,
IconColor,
IconName,
} from '../../types';
} from '@metamask/design-system-shared';

import { IconColor, IconName } from '../../types';

export const MAP_BANNER_ALERT_SEVERITY_ICON_NAME: Record<
(typeof BannerAlertSeverity)[keyof typeof BannerAlertSeverity],
Expand Down
Original file line number Diff line number Diff line change
@@ -1,8 +1,9 @@
import { BoxBackgroundColor } from '@metamask/design-system-shared';
import { useTailwind } from '@metamask/design-system-twrnc-preset';
import { render } from '@testing-library/react-native';
import React from 'react';

import { BoxBackgroundColor, IconColor, IconName } from '../../types';
import { IconColor, IconName } from '../../types';
import { BannerBase } from '../BannerBase';

import { BannerAlert } from './BannerAlert';
Expand Down
Original file line number Diff line number Diff line change
@@ -1,13 +1,15 @@
import {
BoxAlignItems,
BoxBackgroundColor,
BoxFlexDirection,
} from '@metamask/design-system-shared';
import React from 'react';
import { GestureResponderEvent } from 'react-native';

import {
BoxAlignItems,
BoxBackgroundColor,
ButtonIconSize,
ButtonSize,
FontWeight,
BoxFlexDirection,
IconName,
TextVariant,
} from '../../types';
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,7 @@
import type { BoxSpacing, BoxBorderWidth } from '../../types';
import type {
BoxSpacing,
BoxBorderWidth,
} from '@metamask/design-system-shared';

export const TWCLASSMAP_BOX_GAP: Record<BoxSpacing, string> = {
0: 'gap-0',
Expand Down
Original file line number Diff line number Diff line change
@@ -1,16 +1,16 @@
import type { Meta, StoryObj } from '@storybook/react-native';
import React from 'react';
import { ScrollView } from 'react-native';

import {
BoxFlexDirection,
BoxFlexWrap,
BoxAlignItems,
BoxJustifyContent,
BoxBackgroundColor,
BoxBorderColor,
TextColor,
} from '../../types';
} from '@metamask/design-system-shared';
import type { Meta, StoryObj } from '@storybook/react-native';
import React from 'react';
import { ScrollView } from 'react-native';

import { TextColor } from '../../types';
import { Text } from '../Text';

import { Box } from './Box';
Expand Down
Original file line number Diff line number Diff line change
@@ -1,18 +1,17 @@
import { useTailwind } from '@metamask/design-system-twrnc-preset';
import { renderHook } from '@testing-library/react-hooks';
import { render } from '@testing-library/react-native';
import React from 'react';
import { Text } from 'react-native';
import type { StyleProp, ViewStyle } from 'react-native';

import {
BoxFlexDirection,
BoxFlexWrap,
BoxAlignItems,
BoxJustifyContent,
BoxBackgroundColor,
BoxBorderColor,
} from '../../types';
} from '@metamask/design-system-shared';
import { useTailwind } from '@metamask/design-system-twrnc-preset';
import { renderHook } from '@testing-library/react-hooks';
import { render } from '@testing-library/react-native';
import React from 'react';
import { Text } from 'react-native';
import type { StyleProp, ViewStyle } from 'react-native';

import { Box } from './Box';
import {
Expand Down
129 changes: 8 additions & 121 deletions packages/design-system-react-native/src/components/Box/Box.types.ts
Original file line number Diff line number Diff line change
@@ -1,123 +1,10 @@
import type { BoxPropsShared } from '@metamask/design-system-shared';
import type { ViewProps } from 'react-native';

import type {
BoxFlexDirection,
BoxFlexWrap,
BoxSpacing,
BoxBorderWidth,
BoxAlignItems,
BoxJustifyContent,
BoxBackgroundColor,
BoxBorderColor,
} from '../../types';

export type BoxProps = {
/**
* The flexDirection style of the component.
*/
flexDirection?: BoxFlexDirection;
/**
* The flexWrap style of the component.
*/
flexWrap?: BoxFlexWrap;
/**
* The gap between the component's children.
* Use 1-12 for a gap of 4px-48px.
*/
gap?: BoxSpacing;
/**
* The alignItems style of the component.
*/
alignItems?: BoxAlignItems;
/**
* The justifyContent style of the component.
*/
justifyContent?: BoxJustifyContent;
/**
* The margin of the component.
* Use 1-12 for margin of 4px-48px.
*/
margin?: BoxSpacing;
/**
* The top margin of the component.
* Use 1-12 for margin of 4px-48px.
*/
marginTop?: BoxSpacing;
/**
* The right margin of the component.
* Use 1-12 for margin of 4px-48px.
*/
marginRight?: BoxSpacing;
/**
* The bottom margin of the component.
* Use 1-12 for margin of 4px-48px.
*/
marginBottom?: BoxSpacing;
/**
* The left margin of the component.
* Use 1-12 for margin of 4px-48px.
*/
marginLeft?: BoxSpacing;
/**
* The horizontal margin of the component.
* Use 1-12 for margin of 4px-48px.
*/
marginHorizontal?: BoxSpacing;
/**
* The vertical margin of the component.
* Use 1-12 for margin of 4px-48px.
*/
marginVertical?: BoxSpacing;
/**
* The padding of the component.
* Use 1-12 for padding of 4px-48px.
*/
padding?: BoxSpacing;
/**
* The top padding of the component.
* Use 1-12 for padding of 4px-48px.
*/
paddingTop?: BoxSpacing;
/**
* The right padding of the component.
* Use 1-12 for padding of 4px-48px.
*/
paddingRight?: BoxSpacing;
/**
* The bottom padding of the component.
* Use 1-12 for padding of 4px-48px.
*/
paddingBottom?: BoxSpacing;
/**
* The left padding of the component.
* Use 1-12 for padding of 4px-48px.
*/
paddingLeft?: BoxSpacing;
/**
* The horizontal padding of the component.
* Use 1-12 for padding of 4px-48px.
*/
paddingHorizontal?: BoxSpacing;
/**
* The vertical padding of the component.
* Use 1-12 for padding of 4px-48px.
*/
paddingVertical?: BoxSpacing;
/**
* The border width of the component.
* Use 0, 1, 2, 4, or 8 for border width of 0px, 1px, 2px, 4px, or 8px.
*/
borderWidth?: BoxBorderWidth;
/**
* The border color of the component.
*/
borderColor?: BoxBorderColor;
/**
* The background color of the component.
*/
backgroundColor?: BoxBackgroundColor;
/**
* Optional prop to add twrnc overriding classNames.
*/
twClassName?: string;
} & ViewProps;
export type BoxProps = BoxPropsShared &
ViewProps & {
/**
* Optional prop to add twrnc overriding classNames.
*/
twClassName?: string;
};
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,8 @@ export {
BoxJustifyContent,
BoxBackgroundColor,
BoxBorderColor,
} from '../../types';
export type { BoxSpacing, BoxBorderWidth } from '../../types';
type BoxSpacing,
type BoxBorderWidth,
} from '@metamask/design-system-shared';
export { Box } from './Box';
export type { BoxProps } from './Box.types';
Original file line number Diff line number Diff line change
@@ -1,6 +1,9 @@
import {
BoxAlignItems,
BoxFlexDirection,
} from '@metamask/design-system-shared';
import React from 'react';

import { BoxAlignItems, BoxFlexDirection } from '../../types';
import { Box } from '../Box';
import { TextOrChildren } from '../temp-components/TextOrChildren';

Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { BoxFlexDirection } from '@metamask/design-system-shared';
import React from 'react';

import { BoxFlexDirection } from '../../types';
import { Box } from '../Box';
import { TextOrChildren } from '../temp-components/TextOrChildren';

Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import { BoxFlexDirection } from '@metamask/design-system-shared';
import type { Meta, StoryObj } from '@storybook/react-native';

import { BoxFlexDirection, ButtonBaseSize } from '../../types';
import { ButtonBaseSize } from '../../types';
import { Box } from '../Box';
import { IconName } from '../Icon';

Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { BoxBackgroundColor } from '@metamask/design-system-shared';
import type { Meta, StoryObj } from '@storybook/react-native';
import React from 'react';

import { BoxBackgroundColor } from '../../types';
import { Box } from '../Box';
import { Text } from '../Text';

Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { BoxFlexDirection } from '@metamask/design-system-shared';
import type { Meta, StoryObj } from '@storybook/react-native';

import { BoxFlexDirection } from '../../types';
import { Box } from '../Box';
import { IconName } from '../Icon';

Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { BoxBackgroundColor } from '@metamask/design-system-shared';
import type { Meta, StoryObj } from '@storybook/react-native';
import React from 'react';

import { BoxBackgroundColor } from '../../types';
import { Box } from '../Box';
import { Icon, IconName, IconSize } from '../Icon';
import { Text } from '../Text';
Expand Down
Original file line number Diff line number Diff line change
@@ -1,14 +1,12 @@
import type { Meta, StoryObj } from '@storybook/react-native';
import { ScrollView } from 'react-native';

import {
TextVariant,
TextColor,
FontWeight,
BoxFlexDirection,
BoxFlexWrap,
BoxAlignItems,
} from '../../../types';
} from '@metamask/design-system-shared';
import type { Meta, StoryObj } from '@storybook/react-native';
import { ScrollView } from 'react-native';

import { TextVariant, TextColor, FontWeight } from '../../../types';
import { Box } from '../../Box';
import { Text } from '../../Text';

Expand Down
Original file line number Diff line number Diff line change
@@ -1,14 +1,12 @@
import type { Meta, StoryObj } from '@storybook/react-native';
import { ScrollView } from 'react-native';

import {
TextVariant,
TextColor,
FontWeight,
BoxFlexDirection,
BoxFlexWrap,
BoxAlignItems,
} from '../../../types';
} from '@metamask/design-system-shared';
import type { Meta, StoryObj } from '@storybook/react-native';
import { ScrollView } from 'react-native';

import { TextVariant, TextColor, FontWeight } from '../../../types';
import { Box } from '../../Box';
import { Text } from '../../Text';

Expand Down
Original file line number Diff line number Diff line change
@@ -1,14 +1,12 @@
import type { Meta, StoryObj } from '@storybook/react-native';
import { ScrollView } from 'react-native';

import {
TextVariant,
TextColor,
FontWeight,
BoxFlexDirection,
BoxFlexWrap,
BoxAlignItems,
} from '../../../types';
} from '@metamask/design-system-shared';
import type { Meta, StoryObj } from '@storybook/react-native';
import { ScrollView } from 'react-native';

import { TextVariant, TextColor, FontWeight } from '../../../types';
import { Box } from '../../Box';
import { Text } from '../../Text';

Expand Down
Loading
Loading