diff --git a/packages/components/package.json b/packages/components/package.json index c5e4fce471d..f2ffeaeab83 100644 --- a/packages/components/package.json +++ b/packages/components/package.json @@ -9,7 +9,6 @@ "@storybook/core-server": "^7.6.17", "jest": "29.7.0", "phosphor-react": "^1.4.1", - "polished": "^4.2.2", "postinstall-postinstall": "^2.0.0", "react": "18.3.1", "react-dom": "18.3.1", diff --git a/packages/components/src/Alert/Alert.tsx b/packages/components/src/Alert/Alert.tsx index d42ec4d64ad..f603241ad08 100644 --- a/packages/components/src/Alert/Alert.tsx +++ b/packages/components/src/Alert/Alert.tsx @@ -22,17 +22,17 @@ const Container = styled.div<{ $type?: AlertType }>` --color: ${({ $type, theme }) => ` - ${$type === 'success' ? theme.colors.positiveDark : ''} - ${$type === 'loading' ? theme.colors.primaryDark : ''} - ${$type === 'info' ? theme.colors.tealDark : ''} - ${$type === 'error' ? theme.colors.negativeDark : ''} - ${$type === 'warning' ? theme.colors.orangeDark : ''} - ${$type === undefined ? theme.colors.positiveDark : ''} + ${$type === 'success' ? theme.colors.positive : ''} + ${$type === 'loading' ? theme.colors.primary : ''} + ${$type === 'info' ? theme.colors.teal : ''} + ${$type === 'error' ? theme.colors.negative : ''} + ${$type === 'warning' ? theme.colors.orange : ''} + ${$type === undefined ? theme.colors.positive : ''} `}; display: flex; border-radius: 4px; - border: 2px solid var(--color); + border: 1.5px solid var(--color); border-left-width: 0px; background: linear-gradient( to right, diff --git a/packages/components/src/Button/Button.stories.mdx b/packages/components/src/Button/Button.stories.mdx index 0bdacac69ee..b2703925f87 100644 --- a/packages/components/src/Button/Button.stories.mdx +++ b/packages/components/src/Button/Button.stories.mdx @@ -11,34 +11,40 @@ import { Activity } from '../icons' export const Template = (args) => export const Sizes = () => ( - - - - - - - - - - + + + + + + + + + + + + + + + + ) @@ -60,25 +66,41 @@ export const WithIcon = () => ( ) export const Icons = () => ( - - - - - - - + + + + + + + + + + + ) diff --git a/packages/components/src/Button/Button.styles.ts b/packages/components/src/Button/Button.styles.ts index b03e7755f97..3ec8fe1c1b3 100644 --- a/packages/components/src/Button/Button.styles.ts +++ b/packages/components/src/Button/Button.styles.ts @@ -52,6 +52,10 @@ export const primary = ({ loading }: { loading?: boolean }) => css` color: ${({ theme }) => theme.colors.white}; background: ${({ theme }) => theme.colors.primary}; + svg { + color: ${({ theme }) => theme.colors.white}; + } + &:hover { background: ${({ theme }) => theme.colors.primaryDark}; } @@ -66,52 +70,62 @@ export const primary = ({ loading }: { loading?: boolean }) => css` ` export const secondary = css` - border: 2px solid ${({ theme }) => theme.colors.primary}; - color: ${({ theme }) => theme.colors.primary}; + border: 1.5px solid ${({ theme }) => theme.colors.primary}; + color: ${({ theme }) => theme.colors.copy}; + + svg { + color: ${({ theme }) => theme.colors.primary}; + } &:hover { + border: 1.5px solid ${({ theme }) => theme.colors.primaryDark}; background: ${({ theme }) => theme.colors.grey100}; - border: 2px solid ${({ theme }) => theme.colors.primaryDark}; - color: ${({ theme }) => theme.colors.primaryDark}; } &:active { background: ${({ theme }) => theme.colors.grey200}; - color: ${({ theme }) => theme.colors.primaryDarker}; } + &:focus-visible { - border: 2px solid ${({ theme }) => theme.colors.grey600}; + border: 1.5px solid ${({ theme }) => theme.colors.grey600}; background: ${({ theme }) => theme.colors.yellow}; color: ${({ theme }) => theme.colors.grey600}; } ` - export const secondaryNegative = css` - border: 2px solid ${({ theme }) => theme.colors.negative}; - color: ${({ theme }) => theme.colors.negative}; + border: 1.5px solid ${({ theme }) => theme.colors.negative}; + color: ${({ theme }) => theme.colors.copy}; + + svg { + color: ${({ theme }) => theme.colors.negative}; + } &:hover { background: ${({ theme }) => theme.colors.grey100}; - border: 2px solid ${({ theme }) => theme.colors.negativeDark}; - color: ${({ theme }) => theme.colors.negativeDark}; + border: 1.5px solid ${({ theme }) => theme.colors.negativeDark}; } + &:active { background: ${({ theme }) => theme.colors.grey200}; - color: ${({ theme }) => theme.colors.negativeDarker}; } + &:focus-visible { - border: 2px solid ${({ theme }) => theme.colors.negativeDarker}; + border: 1.5px solid ${({ theme }) => theme.colors.negativeDarker}; background: ${({ theme }) => theme.colors.yellow}; color: ${({ theme }) => theme.colors.negativeDarker}; } ` export const tertiary = css` - color: ${({ theme }) => theme.colors.primary}; + color: ${({ theme }) => theme.colors.copy}; + + svg { + color: ${({ theme }) => theme.colors.primary}; + } &:hover { background: ${({ theme }) => theme.colors.grey100}; - color: ${({ theme }) => theme.colors.primaryDark}; } + &:active { background: ${({ theme }) => theme.colors.grey200}; } @@ -121,6 +135,10 @@ export const positive = css` background: ${({ theme }) => theme.colors.positive}; color: ${({ theme }) => theme.colors.white}; + svg { + color: ${({ theme }) => theme.colors.positive}; + } + &:hover { background: ${({ theme }) => theme.colors.positiveDark}; } @@ -133,6 +151,10 @@ export const negative = css` background: ${({ theme }) => theme.colors.negative}; color: ${({ theme }) => theme.colors.white}; + svg { + color: ${({ theme }) => theme.colors.white}; + } + &:hover { background: ${({ theme }) => theme.colors.negativeDark}; } @@ -146,7 +168,7 @@ export const icon = css` border-radius: 100%; aspect-ratio: 1 / 1; - &:hover:not(:focus-visible) { + &:hover { background: ${({ theme }) => theme.colors.grey100}; } &:active { @@ -164,7 +186,7 @@ export const iconPrimary = css` border-radius: 100%; aspect-ratio: 1 / 1; - &:hover:not(:focus-visible) { + &:hover { background: ${({ theme }) => theme.colors.primaryDark}; } &:active { @@ -209,7 +231,7 @@ export const medium = css` ` export const large = css` - ${({ theme }) => theme.fonts.bold18}; + ${({ theme }) => theme.fonts.reg18}; height: 54px; padding: 0 16px; diff --git a/packages/components/src/Pill/Pill.tsx b/packages/components/src/Pill/Pill.tsx index 06324ed4bfa..900d0764371 100644 --- a/packages/components/src/Pill/Pill.tsx +++ b/packages/components/src/Pill/Pill.tsx @@ -34,10 +34,10 @@ const fontMap: Record = { const StyledPill = styled.span<{ size: IPillSize; type: IPillType }>` --background-color: ${({ type, theme }) => ` - ${type === 'active' ? theme.colors.greenLighter : ''} - ${type === 'inactive' ? theme.colors.redLighter : ''} - ${type === 'pending' ? theme.colors.orangeLighter : ''} - ${type === 'default' ? theme.colors.primaryLighter : ''} + ${type === 'active' ? theme.colors.greenLight : ''} + ${type === 'inactive' ? theme.colors.redLight : ''} + ${type === 'pending' ? theme.colors.orangeLight : ''} + ${type === 'default' ? theme.colors.primaryLight : ''} `}; --color: ${({ type, theme }) => ` diff --git a/packages/components/src/colors.ts b/packages/components/src/colors.ts index ba068a8b341..f116ab0e364 100644 --- a/packages/components/src/colors.ts +++ b/packages/components/src/colors.ts @@ -9,52 +9,102 @@ * Copyright (C) The OpenCRVS Authors located at https://github.com/opencrvs/opencrvs-core/blob/master/AUTHORS. */ -import darken from 'polished/lib/color/darken' -import lighten from 'polished/lib/color/lighten' - -const config = { - // Pallete - primary: '#4972BB', // indigo - secondary: '#4A8AD7', // blue - tertiary: '#CCCCCC', // grey - - purple: '#8049B7', // in progress - orange: '#F1B162', // ready for review - red: '#D53F3F', // requires updates - green: '#49b78d', // registered - blue: '#4A8AD7', // certified - teal: '#4CC1BA', // charts - yellow: '#EDC55E', // focus state - - // Status - positive: '#49B78D', // green - neutral: '#F1B162', // orange - negative: '#D53F3F', // red +export const colors = { + // Primary Blue + primary: '#0B68F9', + primaryDark: '#1447b9', + primaryDarker: '#002661', + primaryLight: '#C7DDFF', + primaryLighter: '#E7F0FC', + + // Secondary Purple + purple: '#785AE6', + purpleDark: '#45288A', + purpleDarker: '#373050', + purpleLight: '#D8D3F8', + purpleLighter: '#F0ECF9', + + // Secondary Orange + orange: '#EA8A25', + orangeDark: '#B65618', + orangeDarker: '#753919', + orangeLight: '#F9DFAF', + orangeLighter: '#FEF9EE', + + // Secondary Green + green: '#39AB7F', + greenDark: '#1D7E5E', + greenDarker: '#15503F', + greenLight: '#B3E7CE', + greenLighter: '#EFFAF5', + + // Secondary Red + red: '#D53F3F', + redDark: '#B02525', + redDarker: '#792323', + redLight: '#E79393', + redLighter: '#FAE6E6', + + // Secondary Yellow + yellow: '#FBD91E', + yellowDark: '#E2B605', + yellowDarker: '#85530E', + yellowLight: '#FEFCC3', + yellowLighter: '#FEFDE8', + + // Secondary Teal + teal: '#1E7F93', + tealDark: '#225968', + tealDarker: '#0A3944', + tealLight: '#AEDFEA', + tealLighter: '#EBF7FA', + + // DEPRECTATED + blue: '#4A8AD7', + blueDark: '#4079BD', + blueDarker: '#3668A3', + blueLight: '#72A3E0', + blueLighter: '#A0C3EB', + secondary: '#4A8AD7', + tertiary: '#CCCCCC', + subheaderCopyBirth: '#007A5E', + subheaderCopyDeath: '#4B5EAA', + subheaderCopyMarriage: '#E4BC0C', + backgroundPrimary: '#36304E', - // Monochrome + // Grey white: '#FFFFFF', - grey50: '#F8F8F8', // background - grey100: '#F2F2F2', // hover - grey200: '#E1E1E1', // dividers, active - grey300: '#DDDDDD', // disabled state, borders - grey400: '#B5B5B5', // placeholder copy - grey500: '#6B6B6B', // supporting copy - grey600: '#222222', // copy - - // Opacity + grey50: '#F8F8F8', + grey100: '#F2F2F2', + grey200: '#E1E1E1', + grey300: '#CECECE', + grey400: '#B5B5B5', + grey500: '#6B6B6B', + grey600: '#222222', + + // Utility + positive: '#39AB7F', + positiveDark: '#1D7E5E', + positiveDarker: '#15503F', + positiveLight: '#B3E7CE', + positiveLighter: '#EFFAF5', + neutral: '#EA8A25', + neutralDark: '#B65618', + neutralDarker: '#753919', + neutralLight: '#F9DFAF', + neutralLighter: '#FEF9EE', + negative: '#D53F3F', + negativeDark: '#B02525', + negativeDarker: '#792323', + negativeLight: '#E79393', + negativeLighter: '#FAE6E6', opacity24: 'rgba(41, 47, 51, 0.24)', opacity54: 'rgba(41, 47, 51, 0.54)', - - // Alternative definitions - copy: '#222222', // grey600 - supportingCopy: '#6B6B6B', // grey500 - placeholderCopy: '#B5B5B5', // grey400 - disabled: '#B5B5B5', // grey400 - background: '#F8F8F8', // grey50 - backgroundPrimary: '#36304E', - subheaderCopyBirth: '#007A5E', - subheaderCopyDeath: '#4B5EAA', - subheaderCopyMarriage: '#E4BC0C' + copy: '#222222', + supportingCopy: '#6B6B6B', + placeholderCopy: '#B5B5B5', + disabled: '#B5B5B5', + background: '#F8F8F8' } export const gradients = { @@ -66,62 +116,4 @@ export const shadows = { heavy: 'box-shadow: 0px 2px 8px rgba(53, 67, 93, 0.54)' } -/** - * Color palette with auto-generated light / dark colors from color configuration - */ -export const colors = { - ...config, - - primaryDarker: darken(0.2)(config.primary), - primaryDark: darken(0.1)(config.primary), - primaryLight: lighten(0.2)(config.primary), - primaryLighter: lighten(0.45)(config.primary), - - purpleDarker: darken(0.2)(config.purple), - purpleDark: darken(0.1)(config.purple), - purpleLight: lighten(0.2)(config.purple), - purpleLighter: lighten(0.44)(config.purple), - - orangeDarker: darken(0.2)(config.orange), - orangeDark: darken(0.1)(config.orange), - orangeLight: lighten(0.2)(config.orange), - orangeLighter: lighten(0.3)(config.orange), - - redDarker: darken(0.2)(config.red), - redDark: darken(0.1)(config.red), - redLight: lighten(0.2)(config.red), - redLighter: lighten(0.42)(config.red), - - greenDarker: darken(0.2)(config.green), - greenDark: darken(0.1)(config.green), - greenLight: lighten(0.2)(config.green), - greenLighter: lighten(0.45)(config.green), - - blueDarker: darken(0.2)(config.blue), - blueDark: darken(0.1)(config.blue), - blueLight: lighten(0.2)(config.blue), - blueLighter: lighten(0.4)(config.blue), - - tealDarker: darken(0.2)(config.teal), - tealDark: darken(0.1)(config.teal), - tealLight: lighten(0.2)(config.teal), - tealLighter: lighten(0.4)(config.teal), - - yellowDarker: darken(0.2)(config.yellow), - yellowDark: darken(0.1)(config.yellow), - yellowLight: lighten(0.2)(config.yellow), - yellowLighter: lighten(0.3)(config.yellow), - - positiveDarker: darken(0.2)(config.positive), - positiveDark: darken(0.1)(config.positive), - positiveLight: lighten(0.2)(config.positive), - - neutralDarker: darken(0.2)(config.neutral), - neutralDark: darken(0.1)(config.neutral), - - negativeDarker: darken(0.2)(config.negative), - negativeDark: darken(0.1)(config.negative), - negativeLight: lighten(0.2)(config.negative) -} - export type IColor = keyof typeof colors diff --git a/packages/components/stories/colors.stories.mdx b/packages/components/stories/colors.stories.mdx index 9e3db7b5fed..2b03ac90e7a 100644 --- a/packages/components/stories/colors.stories.mdx +++ b/packages/components/stories/colors.stories.mdx @@ -9,12 +9,12 @@ import styled from 'styled-components'
-## Palette +### Primary + + +### Secondary + + + +/> + - - - - -## Application - - - - - - diff --git a/yarn.lock b/yarn.lock index 6cb5048ccb2..bcc99210a61 100644 --- a/yarn.lock +++ b/yarn.lock @@ -23608,16 +23608,7 @@ string-similarity@^4.0.1: resolved "https://registry.npmjs.org/string-similarity/-/string-similarity-4.0.4.tgz" integrity sha512-/q/8Q4Bl4ZKAPjj8WerIBJWALKkaPRfrvhfF8k/B23i4nzrlRj2/go1m90In7nG/3XDSbOo0+pu6RvCTM9RGMQ== -"string-width-cjs@npm:string-width@^4.2.0": - version "4.2.3" - resolved "https://registry.npmjs.org/string-width/-/string-width-4.2.3.tgz" - integrity sha512-wKyQRQpjJ0sIp62ErSZdGsjMJWsap5oRNihHhu6G7JVO/9jIB6UyevL+tXuOqrng8j/cxKTWyWUwvSTriiZz/g== - dependencies: - emoji-regex "^8.0.0" - is-fullwidth-code-point "^3.0.0" - strip-ansi "^6.0.1" - -"string-width@^1.0.2 || 2 || 3 || 4", string-width@^4.1.0, string-width@^4.2.0, string-width@^4.2.3: +"string-width-cjs@npm:string-width@^4.2.0", "string-width@^1.0.2 || 2 || 3 || 4", string-width@^4.1.0, string-width@^4.2.0, string-width@^4.2.3: version "4.2.3" resolved "https://registry.npmjs.org/string-width/-/string-width-4.2.3.tgz" integrity sha512-wKyQRQpjJ0sIp62ErSZdGsjMJWsap5oRNihHhu6G7JVO/9jIB6UyevL+tXuOqrng8j/cxKTWyWUwvSTriiZz/g== @@ -23777,7 +23768,7 @@ stringify-object@^3.3.0: is-obj "^1.0.1" is-regexp "^1.0.0" -"strip-ansi-cjs@npm:strip-ansi@^6.0.1": +"strip-ansi-cjs@npm:strip-ansi@^6.0.1", strip-ansi@^6.0.0, strip-ansi@^6.0.1: version "6.0.1" resolved "https://registry.npmjs.org/strip-ansi/-/strip-ansi-6.0.1.tgz" integrity sha512-Y38VPSHcqkFrCpFnQ9vuSXmquuv5oXOKpGeT6aGrr3o3Gc9AlVa6JBfUSOCnbxGGZF+/0ooI7KrPuUSztUdU5A== @@ -23798,13 +23789,6 @@ strip-ansi@^5.0.0, strip-ansi@^5.1.0, strip-ansi@^5.2.0: dependencies: ansi-regex "^4.1.0" -strip-ansi@^6.0.0, strip-ansi@^6.0.1: - version "6.0.1" - resolved "https://registry.npmjs.org/strip-ansi/-/strip-ansi-6.0.1.tgz" - integrity sha512-Y38VPSHcqkFrCpFnQ9vuSXmquuv5oXOKpGeT6aGrr3o3Gc9AlVa6JBfUSOCnbxGGZF+/0ooI7KrPuUSztUdU5A== - dependencies: - ansi-regex "^5.0.1" - strip-ansi@^7.0.1, strip-ansi@^7.1.0: version "7.1.0" resolved "https://registry.npmjs.org/strip-ansi/-/strip-ansi-7.1.0.tgz" @@ -26123,7 +26107,7 @@ workbox-window@7.1.0, workbox-window@^7.1.0: "@types/trusted-types" "^2.0.2" workbox-core "7.1.0" -"wrap-ansi-cjs@npm:wrap-ansi@^7.0.0": +"wrap-ansi-cjs@npm:wrap-ansi@^7.0.0", wrap-ansi@^7.0.0: version "7.0.0" resolved "https://registry.npmjs.org/wrap-ansi/-/wrap-ansi-7.0.0.tgz" integrity sha512-YVGIj2kamLSTxw6NsZjoBxfSwsn0ycdesmc4p+Q21c5zPuZ1pl+NfxVdxPtdHvmNVOQ6XSYG4AUtyt/Fi7D16Q== @@ -26150,15 +26134,6 @@ wrap-ansi@^6.0.1, wrap-ansi@^6.2.0: string-width "^4.1.0" strip-ansi "^6.0.0" -wrap-ansi@^7.0.0: - version "7.0.0" - resolved "https://registry.npmjs.org/wrap-ansi/-/wrap-ansi-7.0.0.tgz" - integrity sha512-YVGIj2kamLSTxw6NsZjoBxfSwsn0ycdesmc4p+Q21c5zPuZ1pl+NfxVdxPtdHvmNVOQ6XSYG4AUtyt/Fi7D16Q== - dependencies: - ansi-styles "^4.0.0" - string-width "^4.1.0" - strip-ansi "^6.0.0" - wrap-ansi@^8.0.1, wrap-ansi@^8.1.0: version "8.1.0" resolved "https://registry.npmjs.org/wrap-ansi/-/wrap-ansi-8.1.0.tgz"