1
0
mirror of https://github.com/kremalicious/metamask-extension.git synced 2024-11-29 07:16:36 +01:00
metamask-extension/ui/helpers/constants/design-system.ts

349 lines
8.6 KiB
TypeScript
Raw Normal View History

2021-01-27 18:54:25 +01:00
/**
* A note about the existence of both singular and plural variable names here:
* When dealing with a literal property name, e.g. AlignItems, the constant
2021-01-27 18:54:25 +01:00
* should match the property. When detailing a collection of things, it should
* match the plural form of the thing. e.g. Color, TypographyVariant
2021-01-27 18:54:25 +01:00
*/
export enum Color {
backgroundDefault = 'background-default',
backgroundAlternative = 'background-alternative',
textDefault = 'text-default',
textAlternative = 'text-alternative',
textMuted = 'text-muted',
iconDefault = 'icon-default',
iconAlternative = 'icon-alternative',
iconMuted = 'icon-muted',
borderDefault = 'border-default',
borderMuted = 'border-muted',
overlayDefault = 'overlay-default',
overlayInverse = 'overlay-inverse',
primaryDefault = 'primary-default',
primaryAlternative = 'primary-alternative',
primaryMuted = 'primary-muted',
primaryInverse = 'primary-inverse',
primaryDisabled = 'primary-disabled',
errorDefault = 'error-default',
errorAlternative = 'error-alternative',
errorMuted = 'error-muted',
errorInverse = 'error-inverse',
errorDisabled = 'error-disabled',
warningDefault = 'warning-default',
warningAlternative = 'warning-alternative',
warningMuted = 'warning-muted',
warningInverse = 'warning-inverse',
warningDisabled = 'warning-disabled',
successDefault = 'success-default',
successAlternative = 'success-alternative',
successMuted = 'success-muted',
successInverse = 'success-inverse',
successDisabled = 'success-disabled',
infoDefault = 'info-default',
infoAlternative = 'info-alternative',
infoMuted = 'info-muted',
infoInverse = 'info-inverse',
infoDisabled = 'info-disabled',
mainnet = 'mainnet',
goerli = 'goerli',
sepolia = 'sepolia',
lineaTestnet = 'lineatestnet',
lineaTestnetInverse = 'lineatestnet-inverse',
transparent = 'transparent',
localhost = 'localhost',
inherit = 'inherit',
goerliInverse = 'goerli-inverse',
sepoliaInverse = 'sepolia-inverse',
}
export enum BackgroundColor {
backgroundDefault = 'background-default',
backgroundAlternative = 'background-alternative',
overlayDefault = 'overlay-default',
primaryDefault = 'primary-default',
primaryAlternative = 'primary-alternative',
primaryMuted = 'primary-muted',
errorDefault = 'error-default',
errorAlternative = 'error-Alternative',
errorMuted = 'error-muted',
warningDefault = 'warning-default',
warningAlternative = 'warning-alternative',
warningMuted = 'warning-muted',
successDefault = 'success-default',
successAlternative = 'success-alternative',
successMuted = 'success-muted',
infoDefault = 'info-default',
infoAlternative = 'info-alternative',
infoMuted = 'info-muted',
mainnet = 'mainnet',
goerli = 'goerli',
sepolia = 'sepolia',
lineaTestnet = 'lineatestnet',
transparent = 'transparent',
localhost = 'localhost',
}
export enum BorderColor {
borderDefault = 'border-default',
borderMuted = 'border-muted',
primaryDefault = 'primary-default',
primaryAlternative = 'primary-alternative',
primaryMuted = 'primary-muted',
errorDefault = 'error-default',
errorAlternative = 'error-alternative',
errorMuted = 'error-muted',
warningDefault = 'warning-default',
warningAlternative = 'warning-alternative',
warningMuted = 'warning-muted',
successDefault = 'success-default',
successAlternative = 'success-alternative',
successMuted = 'success-muted',
infoDefault = 'info-default',
infoAlternative = 'info-alternative',
infoMuted = 'info-muted',
mainnet = 'mainnet',
goerli = 'goerli',
sepolia = 'sepolia',
lineaTestnet = 'lineatestnet',
transparent = 'transparent',
localhost = 'localhost',
}
export enum TextColor {
textDefault = 'text-default',
textAlternative = 'text-alternative',
textMuted = 'text-muted',
2023-03-16 21:18:00 +01:00
overlayInverse = 'overlay-inverse',
primaryDefault = 'primary-default',
primaryInverse = 'primary-inverse',
errorDefault = 'error-default',
errorInverse = 'error-inverse',
successDefault = 'success-default',
successInverse = 'success-inverse',
warningDefault = 'warning-default',
warningInverse = 'warning-inverse',
infoDefault = 'info-default',
infoInverse = 'info-inverse',
inherit = 'inherit',
goerli = 'goerli',
sepolia = 'sepolia',
lineaTestnet = 'lineatestnet',
lineaTestnetInverse = 'lineatestnet-inverse',
goerliInverse = 'goerli-inverse',
sepoliaInverse = 'sepolia-inverse',
transparent = 'transparent',
}
2021-01-19 17:30:29 +01:00
export enum IconColor {
iconDefault = 'icon-default',
iconAlternative = 'icon-alternative',
iconMuted = 'icon-muted',
overlayInverse = 'overlay-inverse',
primaryDefault = 'primary-default',
primaryInverse = 'primary-inverse',
errorDefault = 'error-default',
errorInverse = 'error-inverse',
successDefault = 'success-default',
successInverse = 'success-inverse',
warningDefault = 'warning-default',
warningInverse = 'warning-inverse',
infoDefault = 'info-default',
infoInverse = 'info-inverse',
inherit = 'inherit',
goerli = 'goerli',
sepolia = 'sepolia',
lineaTestnet = 'lineatestnet',
lineaTestnetInverse = 'lineatestnet-inverse',
goerliInverse = 'goerli-inverse',
sepoliaInverse = 'sepolia-inverse',
}
export enum TypographyVariant {
H1 = 'h1',
H2 = 'h2',
H3 = 'h3',
H4 = 'h4',
H5 = 'h5',
H6 = 'h6',
H7 = 'h7',
H8 = 'h8',
H9 = 'h9',
paragraph = 'p',
span = 'span',
}
export enum TextVariant {
displayMd = 'display-md',
headingLg = 'heading-lg',
headingMd = 'heading-md',
headingSm = 'heading-sm',
bodyLgMedium = 'body-lg-medium',
bodyMd = 'body-md',
bodyMdBold = 'body-md-bold',
bodySm = 'body-sm',
bodySmBold = 'body-sm-bold',
bodyXs = 'body-xs',
inherit = 'inherit',
}
2021-01-27 18:54:25 +01:00
export enum Size {
XXS = 'xxs',
XS = 'xs',
SM = 'sm',
MD = 'md',
LG = 'lg',
XL = 'xl',
inherit = 'inherit', // Used for Text, Icon, and Button components to inherit the parent elements font-size
auto = 'auto',
none = 'none',
}
export enum BorderStyle {
dashed = 'dashed',
solid = 'solid',
dotted = 'dotted',
double = 'double',
none = 'none',
}
2021-01-27 18:54:25 +01:00
export enum BorderRadius {
XS = 'xs',
SM = 'sm',
MD = 'md',
LG = 'lg',
XL = 'xl',
none = 'none',
pill = 'pill',
full = 'full',
}
2021-01-27 18:54:25 +01:00
// NOTE: The name of this enum is plural due to the name of property in css is `align-items`,
// which is for aligning all items not one
export enum AlignItems {
flexStart = 'flex-start',
flexEnd = 'flex-end',
center = 'center',
baseline = 'baseline',
stretch = 'stretch',
}
2021-01-27 18:54:25 +01:00
export enum JustifyContent {
flexStart = 'flex-start',
flexEnd = 'flex-end',
center = 'center',
spaceAround = 'space-around',
spaceBetween = 'space-between',
spaceEvenly = 'space-evenly',
}
2021-01-27 18:54:25 +01:00
export const FLEX_DIRECTION = {
ROW: 'row',
ROW_REVERSE: 'row-reverse',
COLUMN: 'column',
COLUMN_REVERSE: 'column-reverse',
};
2021-11-01 20:16:23 +01:00
export const FLEX_WRAP = {
WRAP: 'wrap',
WRAP_REVERSE: 'wrap-reverse',
NO_WRAP: 'nowrap',
};
2021-01-27 18:54:25 +01:00
export const DISPLAY = {
BLOCK: 'block',
FLEX: 'flex',
GRID: 'grid',
INLINE_BLOCK: 'inline-block',
INLINE: 'inline',
2021-01-27 18:54:25 +01:00
INLINE_FLEX: 'inline-flex',
INLINE_GRID: 'inline-grid',
LIST_ITEM: 'list-item',
NONE: 'none',
};
2021-01-27 18:54:25 +01:00
export const FRACTIONS = {
2021-01-27 18:54:25 +01:00
HALF: '1/2',
ONE_THIRD: '1/3',
TWO_THIRDS: '2/3',
ONE_FOURTH: '1/4',
TWO_FOURTHS: '2/4',
THREE_FOURTHS: '3/4',
ONE_FIFTH: '1/5',
TWO_FIFTHS: '2/5',
THREE_FIFTHS: '3/5',
FOUR_FIFTHS: '4/5',
ONE_SIXTH: '1/6',
TWO_SIXTHS: '2/6',
THREE_SIXTHS: '3/6',
FOUR_SIXTHS: '4/6',
FIVE_SIXTHS: '5/6',
ONE_TWELFTH: '1/12',
TWO_TWELFTHS: '2/12',
THREE_TWELFTHS: '3/12',
FOUR_TWELFTHS: '4/12',
FIVE_TWELFTHS: '5/12',
SIX_TWELFTHS: '6/12',
SEVEN_TWELFTHS: '7/12',
EIGHT_TWELFTHS: '8/12',
NINE_TWELFTHS: '9/12',
TEN_TWELFTHS: '10/12',
ELEVEN_TWELFTHS: '11/12',
};
2021-01-27 18:54:25 +01:00
export const BLOCK_SIZES = {
...FRACTIONS,
SCREEN: 'screen',
MAX: 'max',
MIN: 'min',
FULL: 'full',
};
2021-01-27 18:54:25 +01:00
export const TEXT_ALIGN = {
LEFT: 'left',
CENTER: 'center',
RIGHT: 'right',
JUSTIFY: 'justify',
END: 'end',
UX: Multichain: Account Menu List (#17947) * UX: Multichain: Account Menu List * Move to using stylesheet * Add hover state * Implement George's suggestions * Add connected site avatar * Add hardware tag * Create story for selected hardware item * Progress on the AccountListItemMenu * Add story for AccountListItemMenu * Better position the account menu * Fix AvatarFavicon missing name prop * Update menu options label to be account specific * Update text of 'View on Explorer' * Add AccountListMenu component * Move all items to multichain directory * Fix paths * Fix linting, use AvatarIcon * Add title and close button to account menu * Center the popover title * Add search functionality * Implementation WIP * Add MULTICHAIN feature flag * Add MULTICHAIN feature flag, add actions for menu items * Properly dispatch events * Fix search box padding * Fix sizing of menu item text * Fix isRequired * Fix alignment of the popover * Update label for hardware wallet items, add text for no search results * Update keyring retreival to remove account and add label * Fix storybook * Fix double link click issue, prevent wrapping of values * Use labelProps for tag variant * Restructure item menu story * Empower storybooks for all new components * Allow only 3 decimals for currencies * Avoid inline styles * Prefix classes with multichain, fix account-list-menu storybook * Close the accounts menu when account details is clicked * Restore tag.js * Create global file for multichain css * Add index file for multichain js * Update file paths * Ensure the block domain is present in menu * Add AccountListItem test * Add AccountListItemMenu tests * Show account connect to current dapp * Improve tests * Make avatar smaller * Add tooltip for account menu * Align icon better * Update snapshot * Rename files to DS standard * Add index files for export * Export all multichain components * Update snapshot * Remove embedded style in popover * Add comments for props, cleanup storybook * Improve test coverage * Improve test code quality * Remove border form avatar * Switch to using the ButtonLink iconName prop * Only show tooltip if character limit is reached * Restore prior search settings * Add test for tooltip
2023-03-22 11:00:08 +01:00
START: 'start',
};
2021-01-27 18:54:25 +01:00
export const TEXT_TRANSFORM = {
UPPERCASE: 'uppercase',
LOWERCASE: 'lowercase',
CAPITALIZE: 'capitalize',
};
2021-01-27 18:54:25 +01:00
export const FONT_WEIGHT = {
BOLD: 'bold',
MEDIUM: 'medium',
2021-01-27 18:54:25 +01:00
NORMAL: 'normal',
};
export const OVERFLOW_WRAP = {
BREAK_WORD: 'break-word',
ANYWHERE: 'anywhere',
NORMAL: 'normal',
};
export const FONT_STYLE = {
ITALIC: 'italic',
NORMAL: 'normal',
};
export const SEVERITIES = {
DANGER: 'danger',
WARNING: 'warning',
INFO: 'info',
SUCCESS: 'success',
};
export const RESIZE = {
NONE: 'none',
BOTH: 'both',
HORIZONTAL: 'horizontal',
VERTICAL: 'vertical',
INITIAL: 'initial',
INHERIT: 'inherit',
};
export const BREAKPOINTS = ['base', 'sm', 'md', 'lg'];