@transferwise/components 0.0.0-experimental-ee20015 → 0.0.0-experimental-8169a99

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -34,6 +34,7 @@ const Avatar = ({
34
34
  const size = backwardsCompatibleSize(sizeFromProps);
35
35
  return /*#__PURE__*/jsxRuntime.jsx(Circle, {
36
36
  size: size,
37
+ fixedSize: true,
37
38
  className: clsx.clsx('tw-avatar', className, `tw-avatar--${size}`, `tw-avatar--${type}`, {
38
39
  'tw-avatar--outlined': outlined,
39
40
  'tw-avatar--branded': Boolean(backgroundColorFromSeed),
@@ -42,6 +43,7 @@ const Avatar = ({
42
43
  "aria-label": ariaLabel,
43
44
  children: /*#__PURE__*/jsxRuntime.jsx(Circle, {
44
45
  size: size,
46
+ fixedSize: true,
45
47
  className: "tw-avatar__content",
46
48
  style: {
47
49
  backgroundColor: backgroundColor || backgroundColorFromSeed
@@ -1 +1 @@
1
- {"version":3,"file":"Avatar.js","sources":["../../src/avatar/Avatar.tsx"],"sourcesContent":["import { clsx } from 'clsx';\nimport { useMemo } from 'react';\n\nimport { Theme } from '../common';\n\nimport { getAvatarColorFromSeed } from './colors';\nimport Circle from '../common/circle';\n\ntype NumericAvatarSize = 24 | 40 | 48 | 56 | 72;\n\ntype LegacyAvatarSize = 'sm' | 'md' | 'lg';\n\nexport type AvatarSize = NumericAvatarSize | LegacyAvatarSize;\n\nexport type AvatarTheme = 'light' | 'dark';\n\nexport type AvatarType = 'thumbnail' | 'icon' | 'emoji' | 'initials';\n\nexport interface AvatarProps {\n backgroundColor?: string;\n backgroundColorSeed?: string;\n children?: React.ReactNode;\n className?: string;\n outlined?: boolean;\n size?: AvatarSize;\n theme?: AvatarTheme;\n type?: AvatarType;\n 'aria-label'?: string;\n}\n\nconst backwardsCompatibleSize = (size: AvatarSize): NumericAvatarSize => {\n switch (size) {\n case 'sm':\n return 24;\n\n case 'md':\n return 48;\n\n case 'lg':\n return 72;\n\n default:\n return size;\n }\n};\n\nconst Avatar: React.FC<AvatarProps> = ({\n backgroundColor = null,\n backgroundColorSeed = null,\n children = null,\n className,\n outlined = false,\n size: sizeFromProps = 48,\n theme = Theme.LIGHT,\n type = 'thumbnail',\n 'aria-label': ariaLabel,\n}) => {\n const backgroundColorFromSeed = useMemo<string | undefined>(\n () =>\n !backgroundColor && backgroundColorSeed\n ? `var(${getAvatarColorFromSeed(backgroundColorSeed)})`\n : undefined,\n [backgroundColor, backgroundColorSeed],\n );\n\n const size = backwardsCompatibleSize(sizeFromProps);\n\n return (\n <Circle\n size={size}\n className={clsx('tw-avatar', className, `tw-avatar--${size}`, `tw-avatar--${type}`, {\n 'tw-avatar--outlined': outlined,\n 'tw-avatar--branded': Boolean(backgroundColorFromSeed),\n 'np-text-title-body': type === 'initials',\n })}\n aria-label={ariaLabel}\n >\n <Circle\n size={size}\n className=\"tw-avatar__content\"\n style={{\n backgroundColor: backgroundColor || backgroundColorFromSeed,\n }}\n >\n {children}\n </Circle>\n </Circle>\n );\n};\n\nexport default Avatar;\n"],"names":["backwardsCompatibleSize","size","Avatar","backgroundColor","backgroundColorSeed","children","className","outlined","sizeFromProps","theme","Theme","LIGHT","type","ariaLabel","backgroundColorFromSeed","useMemo","getAvatarColorFromSeed","undefined","_jsx","Circle","clsx","Boolean","style"],"mappings":";;;;;;;;;AA8BA,MAAMA,uBAAuB,GAAIC,IAAgB,IAAuB;AACtE,EAAA,QAAQA,IAAI;AACV,IAAA,KAAK,IAAI;AACP,MAAA,OAAO,EAAE,CAAA;AAEX,IAAA,KAAK,IAAI;AACP,MAAA,OAAO,EAAE,CAAA;AAEX,IAAA,KAAK,IAAI;AACP,MAAA,OAAO,EAAE,CAAA;AAEX,IAAA;AACE,MAAA,OAAOA,IAAI,CAAA;AACf,GAAA;AACF,CAAC,CAAA;AAEKC,MAAAA,MAAM,GAA0BA,CAAC;AACrCC,EAAAA,eAAe,GAAG,IAAI;AACtBC,EAAAA,mBAAmB,GAAG,I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ar/Avatar.tsx"],"sourcesContent":["import { clsx } from 'clsx';\nimport { useMemo } from 'react';\n\nimport { Theme } from '../common';\n\nimport { getAvatarColorFromSeed } from './colors';\nimport Circle from '../common/circle';\n\ntype NumericAvatarSize = 24 | 40 | 48 | 56 | 72;\n\ntype LegacyAvatarSize = 'sm' | 'md' | 'lg';\n\nexport type AvatarSize = NumericAvatarSize | LegacyAvatarSize;\n\nexport type AvatarTheme = 'light' | 'dark';\n\nexport type AvatarType = 'thumbnail' | 'icon' | 'emoji' | 'initials';\n\nexport interface AvatarProps {\n backgroundColor?: string;\n backgroundColorSeed?: string;\n children?: React.ReactNode;\n className?: string;\n outlined?: boolean;\n size?: AvatarSize;\n theme?: AvatarTheme;\n type?: AvatarType;\n 'aria-label'?: string;\n}\n\nconst backwardsCompatibleSize = (size: AvatarSize): NumericAvatarSize => {\n switch (size) {\n case 'sm':\n return 24;\n\n case 'md':\n return 48;\n\n case 'lg':\n return 72;\n\n default:\n return size;\n }\n};\n\nconst Avatar: React.FC<AvatarProps> = ({\n backgroundColor = null,\n backgroundColorSeed = null,\n children = null,\n className,\n outlined = false,\n size: sizeFromProps = 48,\n theme = Theme.LIGHT,\n type = 'thumbnail',\n 'aria-label': ariaLabel,\n}) => {\n const backgroundColorFromSeed = useMemo<string | undefined>(\n () =>\n !backgroundColor && backgroundColorSeed\n ? `var(${getAvatarColorFromSeed(backgroundColorSeed)})`\n : undefined,\n [backgroundColor, backgroundColorSeed],\n );\n\n const size = backwardsCompatibleSize(sizeFromProps);\n\n return (\n <Circle\n size={size}\n fixedSize\n className={clsx('tw-avatar', className, `tw-avatar--${size}`, `tw-avatar--${type}`, {\n 'tw-avatar--outlined': outlined,\n 'tw-avatar--branded': Boolean(backgroundColorFromSeed),\n 'np-text-title-body': type === 'initials',\n })}\n aria-label={ariaLabel}\n >\n <Circle\n size={size}\n fixedSize\n className=\"tw-avatar__content\"\n style={{\n backgroundColor: backgroundColor || backgroundColorFromSeed,\n }}\n >\n {children}\n </Circle>\n </Circle>\n );\n};\n\nexport default Avatar;\n"],"names":["backwardsCompatibleSize","size","Avatar","backgroundColor","backgroundColorSeed","children","className","outlined","sizeFromProps","theme","Theme","LIGHT","type","ariaLabel","backgroundColorFromSeed","useMemo","getAvatarColorFromSeed","undefined","_jsx","Circle","fixedSize","clsx","Boolean","style"],"mappings":";;;;;;;;;AA8BA,MAAMA,uBAAuB,GAAIC,IAAgB,IAAuB;AACtE,EAAA,QAAQA,IAAI;AACV,IAAA,KAAK,IAAI;AACP,MAAA,OAAO,EAAE,CAAA;AAEX,IAAA,KAAK,IAAI;AACP,MAAA,OAAO,EAAE,CAAA;AAEX,IAAA,KAAK,IAAI;AACP,MAAA,OAAO,EAAE,CAAA;AAEX,IAAA;AACE,MAAA,OAAOA,IAAI,CAAA;AACf,GAAA;AACF,CAAC,CAAA;AAEKC,MAAAA,MAAM,GAA0BA,CAAC;AACrCC,EAAAA,eAAe,GAAG,IAAI;AACtBC,EAAAA,mBAAmB,GAAG,IAAI;AAC1BC,EAAAA,QAAQ,GAAG,IAAI;EACfC,SAAS;AACTC,EAAAA,QAAQ,GAAG,KAAK;EAChBN,IAAI,EAAEO,aAAa,GAAG,EAAE;SACxBC,OAAK,GAAGC,WAAK,CAACC,KAAK;AACnBC,EAAAA,IAAI,GAAG,WAAW;AAClB,EAAA,YAAY,EAAEC,SAAAA;AAAS,CACxB,KAAI;EACH,MAAMC,uBAAuB,GAAGC,aAAO,CACrC,MACE,CAACZ,eAAe,IAAIC,mBAAmB,GACnC,CAAOY,IAAAA,EAAAA,6BAAsB,CAACZ,mBAAmB,CAAC,CAAG,CAAA,CAAA,GACrDa,SAAS,EACf,CAACd,eAAe,EAAEC,mBAAmB,CAAC,CACvC,CAAA;AAED,EAAA,MAAMH,IAAI,GAAGD,uBAAuB,CAACQ,aAAa,CAAC,CAAA;EAEnD,oBACEU,cAAA,CAACC,MAAM,EAAA;AACLlB,IAAAA,IAAI,EAAEA,IAAK;IACXmB,SAAS,EAAA,IAAA;AACTd,IAAAA,SAAS,EAAEe,SAAI,CAAC,WAAW,EAAEf,SAAS,EAAE,CAAcL,WAAAA,EAAAA,IAAI,CAAE,CAAA,EAAE,CAAcW,WAAAA,EAAAA,IAAI,EAAE,EAAE;AAClF,MAAA,qBAAqB,EAAEL,QAAQ;AAC/B,MAAA,oBAAoB,EAAEe,OAAO,CAACR,uBAAuB,CAAC;MACtD,oBAAoB,EAAEF,IAAI,KAAK,UAAA;AAChC,KAAA,CAAE;AACH,IAAA,YAAA,EAAYC,SAAU;IAAAR,QAAA,eAEtBa,cAAA,CAACC,MAAM,EAAA;AACLlB,MAAAA,IAAI,EAAEA,IAAK;MACXmB,SAAS,EAAA,IAAA;AACTd,MAAAA,SAAS,EAAC,oBAAoB;AAC9BiB,MAAAA,KAAK,EAAE;QACLpB,eAAe,EAAEA,eAAe,IAAIW,uBAAAA;OACpC;AAAAT,MAAAA,QAAA,EAEDA,QAAAA;KACK,CAAA;AACV,GAAQ,CAAC,CAAA;AAEb;;;;"}
@@ -32,6 +32,7 @@ const Avatar = ({
32
32
  const size = backwardsCompatibleSize(sizeFromProps);
33
33
  return /*#__PURE__*/jsx(Circle, {
34
34
  size: size,
35
+ fixedSize: true,
35
36
  className: clsx('tw-avatar', className, `tw-avatar--${size}`, `tw-avatar--${type}`, {
36
37
  'tw-avatar--outlined': outlined,
37
38
  'tw-avatar--branded': Boolean(backgroundColorFromSeed),
@@ -40,6 +41,7 @@ const Avatar = ({
40
41
  "aria-label": ariaLabel,
41
42
  children: /*#__PURE__*/jsx(Circle, {
42
43
  size: size,
44
+ fixedSize: true,
43
45
  className: "tw-avatar__content",
44
46
  style: {
45
47
  backgroundColor: backgroundColor || backgroundColorFromSeed
@@ -1 +1 @@
1
- {"version":3,"file":"Avatar.mjs","sources":["../../src/avatar/Avatar.tsx"],"sourcesContent":["import { clsx } from 'clsx';\nimport { useMemo } from 'react';\n\nimport { Theme } from '../common';\n\nimport { getAvatarColorFromSeed } from './colors';\nimport Circle from '../common/circle';\n\ntype NumericAvatarSize = 24 | 40 | 48 | 56 | 72;\n\ntype LegacyAvatarSize = 'sm' | 'md' | 'lg';\n\nexport type AvatarSize = NumericAvatarSize | LegacyAvatarSize;\n\nexport type AvatarTheme = 'light' | 'dark';\n\nexport type AvatarType = 'thumbnail' | 'icon' | 'emoji' | 'initials';\n\nexport interface AvatarProps {\n backgroundColor?: string;\n backgroundColorSeed?: string;\n children?: React.ReactNode;\n className?: string;\n outlined?: boolean;\n size?: AvatarSize;\n theme?: AvatarTheme;\n type?: AvatarType;\n 'aria-label'?: string;\n}\n\nconst backwardsCompatibleSize = (size: AvatarSize): NumericAvatarSize => {\n switch (size) {\n case 'sm':\n return 24;\n\n case 'md':\n return 48;\n\n case 'lg':\n return 72;\n\n default:\n return size;\n }\n};\n\nconst Avatar: React.FC<AvatarProps> = ({\n backgroundColor = null,\n backgroundColorSeed = null,\n children = null,\n className,\n outlined = false,\n size: sizeFromProps = 48,\n theme = Theme.LIGHT,\n type = 'thumbnail',\n 'aria-label': ariaLabel,\n}) => {\n const backgroundColorFromSeed = useMemo<string | undefined>(\n () =>\n !backgroundColor && backgroundColorSeed\n ? `var(${getAvatarColorFromSeed(backgroundColorSeed)})`\n : undefined,\n [backgroundColor, backgroundColorSeed],\n );\n\n const size = backwardsCompatibleSize(sizeFromProps);\n\n return (\n <Circle\n size={size}\n className={clsx('tw-avatar', className, `tw-avatar--${size}`, `tw-avatar--${type}`, {\n 'tw-avatar--outlined': outlined,\n 'tw-avatar--branded': Boolean(backgroundColorFromSeed),\n 'np-text-title-body': type === 'initials',\n })}\n aria-label={ariaLabel}\n >\n <Circle\n size={size}\n className=\"tw-avatar__content\"\n style={{\n backgroundColor: backgroundColor || backgroundColorFromSeed,\n }}\n >\n {children}\n </Circle>\n </Circle>\n );\n};\n\nexport default Avatar;\n"],"names":["backwardsCompatibleSize","size","Avatar","backgroundColor","backgroundColorSeed","children","className","outlined","sizeFromProps","theme","Theme","LIGHT","type","ariaLabel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qBAAqB,EAAEL,QAAQ;AAC/B,MAAA,oBAAoB,EAAEc,OAAO,CAACP,uBAAuB,CAAC;MACtD,oBAAoB,EAAEF,IAAI,KAAK,UAAA;AAChC,KAAA,CAAE;AACH,IAAA,YAAA,EAAYC,SAAU;IAAAR,QAAA,eAEtBa,GAAA,CAACC,MAAM,EAAA;AACLlB,MAAAA,IAAI,EAAEA,IAAK;AACXK,MAAAA,SAAS,EAAC,oBAAoB;AAC9BgB,MAAAA,KAAK,EAAE;QACLnB,eAAe,EAAEA,eAAe,IAAIW,uBAAAA;OACpC;AAAAT,MAAAA,QAAA,EAEDA,QAAAA;KACK,CAAA;AACV,GAAQ,CAAC,CAAA;AAEb;;;;"}
1
+ {"version":3,"file":"Avatar.mjs","sources":["../../src/avatar/Avatar.tsx"],"sourcesContent":["import { clsx } from 'clsx';\nimport { useMemo } from 'react';\n\nimport { Theme } from '../common';\n\nimport { getAvatarColorFromSeed } from './colors';\nimport Circle from '../common/circle';\n\ntype NumericAvatarSize = 24 | 40 | 48 | 56 | 72;\n\ntype LegacyAvatarSize = 'sm' | 'md' | 'lg';\n\nexport type AvatarSize = NumericAvatarSize | LegacyAvatarSize;\n\nexport type AvatarTheme = 'light' | 'dark';\n\nexport type AvatarType = 'thumbnail' | 'icon' | 'emoji' | 'initials';\n\nexport interface AvatarProps {\n backgroundColor?: string;\n backgroundColorSeed?: string;\n children?: React.ReactNode;\n className?: string;\n outlined?: boolean;\n size?: AvatarSize;\n theme?: AvatarTheme;\n type?: AvatarType;\n 'aria-label'?: string;\n}\n\nconst backwardsCompatibleSize = (size: AvatarSize): NumericAvatarSize => {\n switch (size) {\n case 'sm':\n return 24;\n\n case 'md':\n return 48;\n\n case 'lg':\n return 72;\n\n default:\n return size;\n }\n};\n\nconst Avatar: React.FC<AvatarProps> = ({\n backgroundColor = null,\n backgroundColorSeed = null,\n children = null,\n className,\n outlined = false,\n size: sizeFromProps = 48,\n theme = Theme.LIGHT,\n type = 'thumbnail',\n 'aria-label': ariaLabel,\n}) => {\n const backgroundColorFromSeed = useMemo<string | undefined>(\n () =>\n !backgroundColor && backgroundColorSeed\n ? `var(${getAvatarColorFromSeed(backgroundColorSeed)})`\n : undefined,\n [backgroundColor, backgroundColorSeed],\n );\n\n const size = backwardsCompatibleSize(sizeFromProps);\n\n return (\n <Circle\n size={size}\n fixedSize\n className={clsx('tw-avatar', className, `tw-avatar--${size}`, `tw-avatar--${type}`, {\n 'tw-avatar--outlined': outlined,\n 'tw-avatar--branded': Boolean(backgroundColorFromSeed),\n 'np-text-title-body': type === 'initials',\n })}\n aria-label={ariaLabel}\n >\n <Circle\n size={size}\n fixedSize\n className=\"tw-avatar__content\"\n style={{\n backgroundColor: backgroundColor || backgroundColorFromSeed,\n }}\n >\n {children}\n </Circle>\n </Circle>\n );\n};\n\nexport default Avatar;\n"],"names":["backwardsCompatibleSize","size","Avatar","backgroundColor","backgroundColorSeed","children","className","outlined","sizeFromProps","theme","Theme","LIGHT","type","ariaLabel","backgroundColorFromSeed","useMemo","getAvatarColorFromSeed","undefined","_jsx","Circle","fixedSize","clsx","Boolean","style"],"mappings":";;;;;;;AA8BA,MAAMA,uBAAuB,GAAIC,IAAgB,IAAuB;AACtE,EAAA,QAAQA,IAAI;AACV,IAAA,KAAK,IAAI;AACP,MAAA,OAAO,EAAE,CAAA;AAEX,IAAA,KAAK,IAAI;AACP,MAAA,OAAO,EAAE,CAAA;AAEX,IAAA,KAAK,IAAI;AACP,MAAA,OAAO,EAAE,CAAA;AAEX,IAAA;AACE,MAAA,OAAOA,IAAI,CAAA;AACf,GAAA;AACF,CAAC,CAAA;AAEKC,MAAAA,MAAM,GAA0BA,CAAC;AACrCC,EAAAA,eAAe,GAAG,IAAI;AACtBC,EAAAA,mBAAmB,GAAG,IAAI;AAC1BC,EAAAA,QAAQ,GAAG,IAAI;EACfC,SAAS;AACTC,EAAAA,QAAQ,GAAG,KAAK;EAChBN,IAAI,EAAEO,aAAa,GAAG,EAAE;EACxBC,KAAK,G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38
  className: "tw-badge__content",
38
39
  children: badge
39
40
  })]
@@ -1 +1 @@
1
- {"version":3,"file":"Badge.js","sources":["../../src/badge/Badge.tsx"],"sourcesContent":["import { clsx } from 'clsx';\nimport { ReactNode } from 'react';\n\nimport {\n Size,\n Theme,\n SizeSmall,\n SizeMedium,\n SizeLarge,\n ThemeDark,\n ThemeLight,\n CommonProps,\n} from '../common';\nimport Circle, { CircleProps } from '../common/circle';\n\n/**\n * @deprecated Use `SizeSmall` or `SizeLarge` instead.\n */\ntype DeprecatedSizes = SizeMedium;\n\nexport type BadgeProps = {\n badge: ReactNode;\n children: ReactNode;\n /**\n * `md` is deprecated, it will fallback to `sm` instead.\n */\n size?: SizeSmall | DeprecatedSizes | SizeLarge;\n border?: ThemeDark | ThemeLight;\n 'aria-label'?: string;\n} & CommonProps;\n\nconst mapLegacySize = {\n [String(Size.SMALL)]: 16,\n // medium is deprecated, so we map it to small\n [String(Size.MEDIUM)]: 16,\n [String(Size.LARGE)]: 24,\n} satisfies Record<string, CircleProps['size']>;\n\nconst Badge = ({\n badge,\n className = undefined,\n size: sizeProp = Size.SMALL,\n border = Theme.LIGHT,\n 'aria-label': ariaLabel,\n children,\n}: BadgeProps) => {\n // medium is deprecated, so we map it to small\n const size = sizeProp === Size.MEDIUM ? Size.SMALL : sizeProp;\n const classes: string = clsx(\n 'tw-badge',\n {\n [`tw-badge-border-${border}`]: border,\n [`tw-badge-${size}`]: size,\n },\n className,\n );\n\n return (\n <div aria-label={ariaLabel} className={classes}>\n <div className=\"tw-badge__children\">{children}</div>\n <Circle size={mapLegacySize[size]} className=\"tw-badge__content\">\n {badge}\n </Circle>\n </div>\n );\n};\n\nexport default Badge;\n"],"names":["mapLegacySize","String","Size","SMALL","MEDIUM","LARGE","Badge","badge","className","undefined","size","sizeProp","border","Theme","LIGHT","ariaLabel","children","classes","clsx","_jsxs","_jsx","Circle"],"mappings":";;;;;;;;AA+BA,MAAMA,aAAa,GAAG;AACpB,EAAA,CAACC,MAAM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AAEV;;;;"}
1
+ {"version":3,"file":"Badge.js","sources":["../../src/badge/Badge.tsx"],"sourcesContent":["import { clsx } from 'clsx';\nimport { ReactNode } from 'react';\n\nimport {\n Size,\n Theme,\n SizeSmall,\n SizeMedium,\n SizeLarge,\n ThemeDark,\n ThemeLight,\n CommonProps,\n} from '../common';\nimport Circle, { CircleProps } from '../common/circle';\n\n/**\n * @deprecated Use `SizeSmall` or `SizeLarge` instead.\n */\ntype DeprecatedSizes = SizeMedium;\n\nexport type BadgeProps = {\n badge: ReactNode;\n children: ReactNode;\n /**\n * `md` is deprecated, it will fallback to `sm` instead.\n */\n size?: SizeSmall | DeprecatedSizes | SizeLarge;\n border?: ThemeDark | ThemeLight;\n 'aria-label'?: string;\n} & CommonProps;\n\nconst mapLegacySize = {\n [String(Size.SMALL)]: 16,\n // medium is deprecated, so we map it to small\n [String(Size.MEDIUM)]: 16,\n [String(Size.LARGE)]: 24,\n} satisfies Record<string, CircleProps['size']>;\n\nconst Badge = ({\n badge,\n className = undefined,\n size: sizeProp = Size.SMALL,\n border = Theme.LIGHT,\n 'aria-label': ariaLabel,\n children,\n}: BadgeProps) => {\n // medium is deprecated, so we map it to small\n const size = sizeProp === Size.MEDIUM ? Size.SMALL : sizeProp;\n const classes: string = clsx(\n 'tw-badge',\n {\n [`tw-badge-border-${border}`]: border,\n [`tw-badge-${size}`]: size,\n },\n className,\n );\n\n return (\n <div aria-label={ariaLabel} className={classes}>\n <div className=\"tw-badge__children\">{children}</div>\n <Circle size={mapLegacySize[size]} fixedSize className=\"tw-badge__content\">\n {badge}\n </Circle>\n </div>\n );\n};\n\nexport default Badge;\n"],"names":["mapLegacySize","String","Size","SMALL","MEDIUM","LARGE","Badge","badge","className","undefined","size","sizeProp","border","Theme","LIGHT","ariaLabel","children","classes","clsx","_jsxs","_jsx","Circle","fixedSize"],"mappings":";;;;;;;;AA+BA,MAAMA,aAAa,GAAG;AACpB,EAAA,CAACC,MAAM,CAACC,SAAI,CAACC,KAAK,C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;;;;"}
@@ -32,6 +32,7 @@ const Badge = ({
32
32
  children: children
33
33
  }), /*#__PURE__*/jsx(Circle, {
34
34
  size: mapLegacySize[size],
35
+ fixedSize: true,
35
36
  className: "tw-badge__content",
36
37
  children: badge
37
38
  })]
@@ -1 +1 @@
1
- {"version":3,"file":"Badge.mjs","sources":["../../src/badge/Badge.tsx"],"sourcesContent":["import { clsx } from 'clsx';\nimport { ReactNode } from 'react';\n\nimport {\n Size,\n Theme,\n SizeSmall,\n SizeMedium,\n SizeLarge,\n ThemeDark,\n ThemeLight,\n CommonProps,\n} from '../common';\nimport Circle, { CircleProps } from '../common/circle';\n\n/**\n * @deprecated Use `SizeSmall` or `SizeLarge` instead.\n */\ntype DeprecatedSizes = SizeMedium;\n\nexport type BadgeProps = {\n badge: ReactNode;\n children: ReactNode;\n /**\n * `md` is deprecated, it will fallback to `sm` instead.\n */\n size?: SizeSmall | DeprecatedSizes | SizeLarge;\n border?: ThemeDark | ThemeLight;\n 'aria-label'?: string;\n} & CommonProps;\n\nconst mapLegacySize = {\n [String(Size.SMALL)]: 16,\n // medium is deprecated, so we map it to small\n [String(Size.MEDIUM)]: 16,\n [String(Size.LARGE)]: 24,\n} satisfies Record<string, CircleProps['size']>;\n\nconst Badge = ({\n badge,\n className = undefined,\n size: sizeProp = Size.SMALL,\n border = Theme.LIGHT,\n 'aria-label': ariaLabel,\n children,\n}: BadgeProps) => {\n // medium is deprecated, so we map it to small\n const size = sizeProp === Size.MEDIUM ? Size.SMALL : sizeProp;\n const classes: string = clsx(\n 'tw-badge',\n {\n [`tw-badge-border-${border}`]: border,\n [`tw-badge-${size}`]: size,\n },\n className,\n );\n\n return (\n <div aria-label={ariaLabel} className={classes}>\n <div className=\"tw-badge__children\">{children}</div>\n <Circle size={mapLegacySize[size]} className=\"tw-badge__content\">\n {badge}\n </Circle>\n </div>\n );\n};\n\nexport default Badge;\n"],"names":["mapLegacySize","String","Size","SMALL","MEDIUM","LARGE","Badge","badge","className","undefined","size","siz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AE;AAACF,MAAAA,SAAS,EAAC,mBAAmB;AAAAQ,MAAAA,QAAA,EAC7DT,KAAAA;AAAK,KACA,CACV,CAAA;AAAA,GAAK,CAAC,CAAA;AAEV;;;;"}
1
+ {"version":3,"file":"Badge.mjs","sources":["../../src/badge/Badge.tsx"],"sourcesContent":["import { clsx } from 'clsx';\nimport { ReactNode } from 'react';\n\nimport {\n Size,\n Theme,\n SizeSmall,\n SizeMedium,\n SizeLarge,\n ThemeDark,\n ThemeLight,\n CommonProps,\n} from '../common';\nimport Circle, { CircleProps } from '../common/circle';\n\n/**\n * @deprecated Use `SizeSmall` or `SizeLarge` instead.\n */\ntype DeprecatedSizes = SizeMedium;\n\nexport type BadgeProps = {\n badge: ReactNode;\n children: ReactNode;\n /**\n * `md` is deprecated, it will fallback to `sm` instead.\n */\n size?: SizeSmall | DeprecatedSizes | SizeLarge;\n border?: ThemeDark | ThemeLight;\n 'aria-label'?: string;\n} & CommonProps;\n\nconst mapLegacySize = {\n [String(Size.SMALL)]: 16,\n // medium is deprecated, so we map it to small\n [String(Size.MEDIUM)]: 16,\n [String(Size.LARGE)]: 24,\n} satisfies Record<string, CircleProps['size']>;\n\nconst Badge = ({\n badge,\n className = undefined,\n size: sizeProp = Size.SMALL,\n border = Theme.LIGHT,\n 'aria-label': ariaLabel,\n children,\n}: BadgeProps) => {\n // medium is deprecated, so we map it to small\n const size = sizeProp === Size.MEDIUM ? Size.SMALL : sizeProp;\n const classes: string = clsx(\n 'tw-badge',\n {\n [`tw-badge-border-${border}`]: border,\n [`tw-badge-${size}`]: size,\n },\n className,\n );\n\n return (\n <div aria-label={ariaLabel} className={classes}>\n <div className=\"tw-badge__children\">{children}</div>\n <Circle size={mapLegacySize[size]} fixedSize className=\"tw-badge__content\">\n {badge}\n </Circle>\n </div>\n );\n};\n\nexport default Badge;\n"],"names":["mapLegacySize","String","Size","SMALL","MEDIUM","LARGE","Badge","badge","className","undefined","size","sizeProp","border","Theme","LIGHT","ariaLabel","children","classes","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;AAACd,MAAAA,SAAS,EAAC,mBAAmB;AAAAQ,MAAAA,QAAA,EACvET,KAAAA;AAAK,KACA,CACV,CAAA;AAAA,GAAK,CAAC,CAAA;AAEV;;;;"}
@@ -8,6 +8,7 @@ const Circle = /*#__PURE__*/React.forwardRef(function Circle({
8
8
  as: Element = 'div',
9
9
  children,
10
10
  size = 48,
11
+ fixedSize = false,
11
12
  className,
12
13
  style,
13
14
  ...props
@@ -17,7 +18,7 @@ const Circle = /*#__PURE__*/React.forwardRef(function Circle({
17
18
  ref: ref,
18
19
  style: {
19
20
  ...style,
20
- '--circle-size': `var(--size-${size})`
21
+ '--circle-size': fixedSize ? `${size}px` : `var(--size-${size})`
21
22
  },
22
23
  className: clsx.clsx('np-circle', 'd-flex align-items-center justify-content-center', className),
23
24
  children: children
@@ -1 +1 @@
1
- {"version":3,"file":"Circle.js","sources":["../../../src/common/circle/Circle.tsx"],"sourcesContent":["import { HTMLAttributes, forwardRef } from 'react';\nimport { clsx } from 'clsx';\n\n/**\n * Same sizes as `--size-*` tokens\n */\nexport type ShapeSize = 16 | 24 | 32 | 40 | 48 | 56 | 64 | 72;\n\nexport type Props = {\n as?: React.ElementType;\n size?: ShapeSize;\n} & HTMLAttributes<HTMLDivElement>;\n\nconst Circle = forwardRef(function Circle(\n { as: Element = 'div', children, size = 48, className, style, ...props }: Props,\n ref,\n) {\n return (\n <Element\n {...props}\n ref={ref}\n style={{ ...style, '--circle-size': `var(--size-${size})` }}\n className={clsx('np-circle', 'd-flex align-items-center justify-content-center', className)}\n >\n {children}\n </Element>\n );\n});\n\nexport default Circle;\n"],"names":["Circle","forwardRef","as","Element","children","size","className","style","props","ref","_jsx","clsx"],"mappings":";;;;;;AAaA,MAAMA,MAAM,gBAAGC,gBAAU,CAAC,SAASD,MAAMA,CACvC;EAAEE,EAAE,EAAEC,OAAO,GAAG,KAAK;EAAEC,QAAQ;AAAEC,EAAAA,IAAI,GAAG,EAAE;EAAEC,SAAS;EAAEC,KAAK;EAAE,GAAGC,KAAAA;AAAc,CAAA,EAC/EC,GAAG,EAAA;EAEH,oBACEC,cAAA,CAACP,OAAO,EAAA;AAAA,IAAA,GACFK,KAAK;AACTC,IAAAA,GAAG,EAAEA,GAAI;AACTF,IAAAA,KAAK,EAAE;AAAE,MAAA,GAAGA,KAAK;MAAE,eAAe,EAAE,cAAcF,IAAI,CAAA,CAAA,CAAA;KAAM;IAC5DC,SAAS,EAAEK,SAAI,CAAC,WAAW,EAAE,kDAAkD,EAAEL,SAAS,CAAE;AAAAF,IAAAA,QAAA,EAE3FA,QAAAA;AAAQ,GACF,CAAC,CAAA;AAEd,CAAC;;;;"}
1
+ {"version":3,"file":"Circle.js","sources":["../../../src/common/circle/Circle.tsx"],"sourcesContent":["import { HTMLAttributes, forwardRef } from 'react';\nimport { clsx } from 'clsx';\n\nexport type ShapeSize = 16 | 24 | 32 | 40 | 48 | 56 | 64 | 72;\n\nexport type Props = {\n as?: React.ElementType;\n size?: ShapeSize;\n fixedSize?: boolean;\n} & HTMLAttributes<HTMLDivElement>;\n\nconst Circle = forwardRef(function Circle(\n {\n as: Element = 'div',\n children,\n size = 48,\n fixedSize = false,\n className,\n style,\n ...props\n }: Props,\n ref,\n) {\n return (\n <Element\n {...props}\n ref={ref}\n style={{ ...style, '--circle-size': fixedSize ? `${size}px` : `var(--size-${size})` }}\n className={clsx('np-circle', 'd-flex align-items-center justify-content-center', className)}\n >\n {children}\n </Element>\n );\n});\n\nexport default Circle;\n"],"names":["Circle","forwardRef","as","Element","children","size","fixedSize","className","style","props","ref","_jsx","clsx"],"mappings":";;;;;;AAWA,MAAMA,MAAM,gBAAGC,gBAAU,CAAC,SAASD,MAAMA,CACvC;EACEE,EAAE,EAAEC,OAAO,GAAG,KAAK;EACnBC,QAAQ;AACRC,EAAAA,IAAI,GAAG,EAAE;AACTC,EAAAA,SAAS,GAAG,KAAK;EACjBC,SAAS;EACTC,KAAK;EACL,GAAGC,KAAAA;AAAK,CACF,EACRC,GAAG,EAAA;EAEH,oBACEC,cAAA,CAACR,OAAO,EAAA;AAAA,IAAA,GACFM,KAAK;AACTC,IAAAA,GAAG,EAAEA,GAAI;AACTF,IAAAA,KAAK,EAAE;AAAE,MAAA,GAAGA,KAAK;MAAE,eAAe,EAAEF,SAAS,GAAG,CAAA,EAAGD,IAAI,CAAI,EAAA,CAAA,GAAG,cAAcA,IAAI,CAAA,CAAA,CAAA;KAAM;IACtFE,SAAS,EAAEK,SAAI,CAAC,WAAW,EAAE,kDAAkD,EAAEL,SAAS,CAAE;AAAAH,IAAAA,QAAA,EAE3FA,QAAAA;AAAQ,GACF,CAAC,CAAA;AAEd,CAAC;;;;"}
@@ -6,6 +6,7 @@ const Circle = /*#__PURE__*/forwardRef(function Circle({
6
6
  as: Element = 'div',
7
7
  children,
8
8
  size = 48,
9
+ fixedSize = false,
9
10
  className,
10
11
  style,
11
12
  ...props
@@ -15,7 +16,7 @@ const Circle = /*#__PURE__*/forwardRef(function Circle({
15
16
  ref: ref,
16
17
  style: {
17
18
  ...style,
18
- '--circle-size': `var(--size-${size})`
19
+ '--circle-size': fixedSize ? `${size}px` : `var(--size-${size})`
19
20
  },
20
21
  className: clsx('np-circle', 'd-flex align-items-center justify-content-center', className),
21
22
  children: children
@@ -1 +1 @@
1
- {"version":3,"file":"Circle.mjs","sources":["../../../src/common/circle/Circle.tsx"],"sourcesContent":["import { HTMLAttributes, forwardRef } from 'react';\nimport { clsx } from 'clsx';\n\n/**\n * Same sizes as `--size-*` tokens\n */\nexport type ShapeSize = 16 | 24 | 32 | 40 | 48 | 56 | 64 | 72;\n\nexport type Props = {\n as?: React.ElementType;\n size?: ShapeSize;\n} & HTMLAttributes<HTMLDivElement>;\n\nconst Circle = forwardRef(function Circle(\n { as: Element = 'div', children, size = 48, className, style, ...props }: Props,\n ref,\n) {\n return (\n <Element\n {...props}\n ref={ref}\n style={{ ...style, '--circle-size': `var(--size-${size})` }}\n className={clsx('np-circle', 'd-flex align-items-center justify-content-center', className)}\n >\n {children}\n </Element>\n );\n});\n\nexport default Circle;\n"],"names":["Circle","forwardRef","as","Element","children","size","className","style","props","ref","_jsx","clsx"],"mappings":";;;;AAaA,MAAMA,MAAM,gBAAGC,UAAU,CAAC,SAASD,MAAMA,CACvC;EAAEE,EAAE,EAAEC,OAAO,GAAG,KAAK;EAAEC,QAAQ;AAAEC,EAAAA,IAAI,GAAG,EAAE;EAAEC,SAAS;EAAEC,KAAK;EAAE,GAAGC,KAAAA;AAAc,CAAA,EAC/EC,GAAG,EAAA;EAEH,oBACEC,GAAA,CAACP,OAAO,EAAA;AAAA,IAAA,GACFK,KAAK;AACTC,IAAAA,GAAG,EAAEA,GAAI;AACTF,IAAAA,KAAK,EAAE;AAAE,MAAA,GAAGA,KAAK;MAAE,eAAe,EAAE,cAAcF,IAAI,CAAA,CAAA,CAAA;KAAM;IAC5DC,SAAS,EAAEK,IAAI,CAAC,WAAW,EAAE,kDAAkD,EAAEL,SAAS,CAAE;AAAAF,IAAAA,QAAA,EAE3FA,QAAAA;AAAQ,GACF,CAAC,CAAA;AAEd,CAAC;;;;"}
1
+ {"version":3,"file":"Circle.mjs","sources":["../../../src/common/circle/Circle.tsx"],"sourcesContent":["import { HTMLAttributes, forwardRef } from 'react';\nimport { clsx } from 'clsx';\n\nexport type ShapeSize = 16 | 24 | 32 | 40 | 48 | 56 | 64 | 72;\n\nexport type Props = {\n as?: React.ElementType;\n size?: ShapeSize;\n fixedSize?: boolean;\n} & HTMLAttributes<HTMLDivElement>;\n\nconst Circle = forwardRef(function Circle(\n {\n as: Element = 'div',\n children,\n size = 48,\n fixedSize = false,\n className,\n style,\n ...props\n }: Props,\n ref,\n) {\n return (\n <Element\n {...props}\n ref={ref}\n style={{ ...style, '--circle-size': fixedSize ? `${size}px` : `var(--size-${size})` }}\n className={clsx('np-circle', 'd-flex align-items-center justify-content-center', className)}\n >\n {children}\n </Element>\n );\n});\n\nexport default Circle;\n"],"names":["Circle","forwardRef","as","Element","children","size","fixedSize","className","style","props","ref","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,CAAC;AAEF,eAAe,MAAM,CAAC"}
@@ -1,15 +1,14 @@
1
1
  import { HTMLAttributes } from 'react';
2
- /**
3
- * Same sizes as `--size-*` tokens
4
- */
5
2
  export type ShapeSize = 16 | 24 | 32 | 40 | 48 | 56 | 64 | 72;
6
3
  export type Props = {
7
4
  as?: React.ElementType;
8
5
  size?: ShapeSize;
6
+ fixedSize?: boolean;
9
7
  } & HTMLAttributes<HTMLDivElement>;
10
8
  declare const Circle: import("react").ForwardRefExoticComponent<{
11
9
  as?: React.ElementType;
12
10
  size?: ShapeSize;
11
+ fixedSize?: boolean;
13
12
  } & HTMLAttributes<HTMLDivElement> & import("react").RefAttributes<unknown>>;
14
13
  export default Circle;
15
14
  //# sourceMappingURL=Circle.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"Circle.d.ts","sourceRoot":"","sources":["../../../../src/common/circle/Circle.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,cAAc,EAAc,MAAM,OAAO,CAAC;AAGnD;;GAEG;AACH,MAAM,MAAM,SAAS,GAAG,EAAE,GAAG,EAAE,GAAG,EAAE,GAAG,EAAE,GAAG,EAAE,GAAG,EAAE,GAAG,EAAE,GAAG,EAAE,CAAC;AAE9D,MAAM,MAAM,KAAK,GAAG;IAClB,EAAE,CAAC,EAAE,KAAK,CAAC,WAAW,CAAC;IACvB,IAAI,CAAC,EAAE,SAAS,CAAC;CAClB,GAAG,cAAc,CAAC,cAAc,CAAC,CAAC;AAEnC,QAAA,MAAM,MAAM;SAJL,KAAK,CAAC,WAAW;WACf,SAAS;4EAiBhB,CAAC;AAEH,eAAe,MAAM,CAAC"}
1
+ {"version":3,"file":"Circle.d.ts","sourceRoot":"","sources":["../../../../src/common/circle/Circle.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,cAAc,EAAc,MAAM,OAAO,CAAC;AAGnD,MAAM,MAAM,SAAS,GAAG,EAAE,GAAG,EAAE,GAAG,EAAE,GAAG,EAAE,GAAG,EAAE,GAAG,EAAE,GAAG,EAAE,GAAG,EAAE,CAAC;AAE9D,MAAM,MAAM,KAAK,GAAG;IAClB,EAAE,CAAC,EAAE,KAAK,CAAC,WAAW,CAAC;IACvB,IAAI,CAAC,EAAE,SAAS,CAAC;IACjB,SAAS,CAAC,EAAE,OAAO,CAAC;CACrB,GAAG,cAAc,CAAC,cAAc,CAAC,CAAC;AAEnC,QAAA,MAAM,MAAM;SALL,KAAK,CAAC,WAAW;WACf,SAAS;gBACJ,OAAO;4EAyBnB,CAAC;AAEH,eAAe,MAAM,CAAC"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@transferwise/components",
3
- "version": "0.0.0-experimental-ee20015",
3
+ "version": "0.0.0-experimental-8169a99",
4
4
  "description": "Neptune React components",
5
5
  "license": "Apache-2.0",
6
6
  "repository": {
@@ -92,12 +92,12 @@
92
92
  "rollup-preserve-directives": "^1.1.1",
93
93
  "storybook": "^8.2.2",
94
94
  "@transferwise/less-config": "3.1.0",
95
- "@transferwise/neptune-css": "0.0.0-experimental-ee20015",
95
+ "@transferwise/neptune-css": "0.0.0-experimental-8169a99",
96
96
  "@wise/components-theming": "1.6.0"
97
97
  },
98
98
  "peerDependencies": {
99
99
  "@transferwise/icons": "^3.13.1",
100
- "@transferwise/neptune-css": "0.0.0-experimental-ee20015",
100
+ "@transferwise/neptune-css": "0.0.0-experimental-8169a99",
101
101
  "@wise/art": "^2.7.0",
102
102
  "@wise/components-theming": "^1.0.0",
103
103
  "react": ">=18",
@@ -68,6 +68,7 @@ const Avatar: React.FC<AvatarProps> = ({
68
68
  return (
69
69
  <Circle
70
70
  size={size}
71
+ fixedSize
71
72
  className={clsx('tw-avatar', className, `tw-avatar--${size}`, `tw-avatar--${type}`, {
72
73
  'tw-avatar--outlined': outlined,
73
74
  'tw-avatar--branded': Boolean(backgroundColorFromSeed),
@@ -77,6 +78,7 @@ const Avatar: React.FC<AvatarProps> = ({
77
78
  >
78
79
  <Circle
79
80
  size={size}
81
+ fixedSize
80
82
  className="tw-avatar__content"
81
83
  style={{
82
84
  backgroundColor: backgroundColor || backgroundColorFromSeed,
@@ -3,11 +3,11 @@
3
3
  exports[`FlowNavigationAvatar with a name AND profileType FlowNavigationAvatar with a name AND profileType AND avatar url renders the image 1`] = `
4
4
  <div
5
5
  class="np-circle d-flex align-items-center justify-content-center tw-avatar tw-avatar--48 tw-avatar--thumbnail"
6
- style="--circle-size: var(--size-48);"
6
+ style="--circle-size: 48px;"
7
7
  >
8
8
  <div
9
9
  class="np-circle d-flex align-items-center justify-content-center tw-avatar__content"
10
- style="--circle-size: var(--size-48);"
10
+ style="--circle-size: 48px;"
11
11
  >
12
12
  <img
13
13
  alt=""
@@ -20,11 +20,11 @@ exports[`FlowNavigationAvatar with a name AND profileType FlowNavigationAvatar w
20
20
  exports[`FlowNavigationAvatar with a name AND profileType FlowNavigationAvatar with a name AND profileType renders as BUSINESS profile type with an icon 1`] = `
21
21
  <div
22
22
  class="np-circle d-flex align-items-center justify-content-center tw-avatar tw-avatar--48 tw-avatar--icon"
23
- style="--circle-size: var(--size-48);"
23
+ style="--circle-size: 48px;"
24
24
  >
25
25
  <div
26
26
  class="np-circle d-flex align-items-center justify-content-center tw-avatar__content"
27
- style="--circle-size: var(--size-48);"
27
+ style="--circle-size: 48px;"
28
28
  >
29
29
  <span
30
30
  class="tw-icon tw-icon-briefcase "
@@ -51,11 +51,11 @@ exports[`FlowNavigationAvatar with a name AND profileType FlowNavigationAvatar w
51
51
  exports[`FlowNavigationAvatar with a name AND profileType FlowNavigationAvatar with a name AND profileType renders as PERSONAL profile type with an icon 1`] = `
52
52
  <div
53
53
  class="np-circle d-flex align-items-center justify-content-center tw-avatar tw-avatar--48 tw-avatar--icon"
54
- style="--circle-size: var(--size-48);"
54
+ style="--circle-size: 48px;"
55
55
  >
56
56
  <div
57
57
  class="np-circle d-flex align-items-center justify-content-center tw-avatar__content"
58
- style="--circle-size: var(--size-48);"
58
+ style="--circle-size: 48px;"
59
59
  >
60
60
  <span
61
61
  class="tw-icon tw-icon-person "
@@ -88,11 +88,11 @@ exports[`FlowNavigationAvatar with a name AND profileType with a badge url passe
88
88
  >
89
89
  <div
90
90
  class="np-circle d-flex align-items-center justify-content-center tw-avatar tw-avatar--48 tw-avatar--icon"
91
- style="--circle-size: var(--size-48);"
91
+ style="--circle-size: 48px;"
92
92
  >
93
93
  <div
94
94
  class="np-circle d-flex align-items-center justify-content-center tw-avatar__content"
95
- style="--circle-size: var(--size-48);"
95
+ style="--circle-size: 48px;"
96
96
  >
97
97
  <span
98
98
  class="tw-icon tw-icon-person "
@@ -117,7 +117,7 @@ exports[`FlowNavigationAvatar with a name AND profileType with a badge url passe
117
117
  </div>
118
118
  <div
119
119
  class="np-circle d-flex align-items-center justify-content-center tw-badge__content"
120
- style="--circle-size: var(--size-24);"
120
+ style="--circle-size: 24px;"
121
121
  >
122
122
  <img
123
123
  alt="badge alt text"
@@ -130,11 +130,11 @@ exports[`FlowNavigationAvatar with a name AND profileType with a badge url passe
130
130
  exports[`FlowNavigationAvatar with a name AND profileType with nothing passed renders a personal icon 1`] = `
131
131
  <div
132
132
  class="np-circle d-flex align-items-center justify-content-center tw-avatar tw-avatar--48 tw-avatar--icon"
133
- style="--circle-size: var(--size-48);"
133
+ style="--circle-size: 48px;"
134
134
  >
135
135
  <div
136
136
  class="np-circle d-flex align-items-center justify-content-center tw-avatar__content"
137
- style="--circle-size: var(--size-48);"
137
+ style="--circle-size: 48px;"
138
138
  >
139
139
  <span
140
140
  class="tw-icon tw-icon-person "
@@ -58,7 +58,7 @@ const Badge = ({
58
58
  return (
59
59
  <div aria-label={ariaLabel} className={classes}>
60
60
  <div className="tw-badge__children">{children}</div>
61
- <Circle size={mapLegacySize[size]} className="tw-badge__content">
61
+ <Circle size={mapLegacySize[size]} fixedSize className="tw-badge__content">
62
62
  {badge}
63
63
  </Circle>
64
64
  </div>
@@ -0,0 +1,143 @@
1
+ import { Meta, StoryObj } from '@storybook/react';
2
+ import { storyConfig } from '../../test-utils';
3
+ import Circle from './Circle';
4
+ import { Profile } from '@transferwise/icons';
5
+
6
+ export default {
7
+ title: 'Internal/Circle',
8
+ } satisfies Meta<typeof Circle>;
9
+
10
+ type Story = StoryObj<typeof Circle>;
11
+
12
+ export const Basic: Story = storyConfig(
13
+ {
14
+ render: () => {
15
+ const content = <Profile size={16} />;
16
+ const style = { border: '1px solid var(--color-border-neutral)' };
17
+ return (
18
+ <table border={0} cellPadding="0" cellSpacing="0">
19
+ <tr>
20
+ <td>
21
+ <Circle size={32} style={style}>
22
+ {content}
23
+ </Circle>
24
+ </td>
25
+ <td>
26
+ <Circle size={40} style={style}>
27
+ {content}
28
+ </Circle>
29
+ </td>
30
+ <td>
31
+ <Circle size={48} style={style}>
32
+ {content}
33
+ </Circle>
34
+ </td>
35
+ <td>
36
+ <Circle size={56} style={style}>
37
+ {content}
38
+ </Circle>
39
+ </td>
40
+ <td>
41
+ <Circle size={72} style={style}>
42
+ {content}
43
+ </Circle>
44
+ </td>
45
+ </tr>
46
+ <tr>
47
+ <td>
48
+ <Circle
49
+ as="button"
50
+ style={style}
51
+ className="bg-neutral"
52
+ size={32}
53
+ onClick={() => alert('button instance')}
54
+ >
55
+ {content}
56
+ </Circle>
57
+ </td>
58
+ <td>
59
+ <Circle
60
+ as="button"
61
+ style={style}
62
+ className="bg-neutral"
63
+ size={40}
64
+ onClick={() => alert('button instance')}
65
+ >
66
+ {content}
67
+ </Circle>
68
+ </td>
69
+ <td>
70
+ <Circle
71
+ as="button"
72
+ style={style}
73
+ className="bg-neutral"
74
+ size={48}
75
+ onClick={() => alert('button instance')}
76
+ >
77
+ {content}
78
+ </Circle>
79
+ </td>
80
+ <td>
81
+ <Circle
82
+ as="button"
83
+ style={style}
84
+ className="bg-neutral"
85
+ size={56}
86
+ onClick={() => alert('button instance')}
87
+ >
88
+ {content}
89
+ </Circle>
90
+ </td>
91
+ <td>
92
+ <Circle
93
+ as="button"
94
+ style={style}
95
+ className="bg-neutral"
96
+ size={72}
97
+ onClick={() => alert('button instance')}
98
+ >
99
+ {content}
100
+ </Circle>
101
+ </td>
102
+ </tr>
103
+ </table>
104
+ );
105
+ },
106
+ },
107
+ { variants: ['light', 'dark'] },
108
+ );
109
+
110
+ export const FixedSize: Story = storyConfig(
111
+ {
112
+ render: () => {
113
+ const size = 72;
114
+ const content = <Profile size={16} />;
115
+ const style = { border: '1px solid var(--color-border-neutral)' };
116
+ return (
117
+ <table border={0} cellPadding="0" cellSpacing="0">
118
+ <tr>
119
+ <td>
120
+ Dynamic Size (<code>--size-{size})</code>
121
+ </td>
122
+ <td>
123
+ Fixed Size (<code>{size}px)</code>
124
+ </td>
125
+ </tr>
126
+ <tr>
127
+ <td>
128
+ <Circle size={72} fixedSize={false} style={style}>
129
+ {content}
130
+ </Circle>
131
+ </td>
132
+ <td>
133
+ <Circle size={72} fixedSize style={style}>
134
+ {content}
135
+ </Circle>
136
+ </td>
137
+ </tr>
138
+ </table>
139
+ );
140
+ },
141
+ },
142
+ { variants: ['400%'] },
143
+ );
@@ -1,25 +1,31 @@
1
1
  import { HTMLAttributes, forwardRef } from 'react';
2
2
  import { clsx } from 'clsx';
3
3
 
4
- /**
5
- * Same sizes as `--size-*` tokens
6
- */
7
4
  export type ShapeSize = 16 | 24 | 32 | 40 | 48 | 56 | 64 | 72;
8
5
 
9
6
  export type Props = {
10
7
  as?: React.ElementType;
11
8
  size?: ShapeSize;
9
+ fixedSize?: boolean;
12
10
  } & HTMLAttributes<HTMLDivElement>;
13
11
 
14
12
  const Circle = forwardRef(function Circle(
15
- { as: Element = 'div', children, size = 48, className, style, ...props }: Props,
13
+ {
14
+ as: Element = 'div',
15
+ children,
16
+ size = 48,
17
+ fixedSize = false,
18
+ className,
19
+ style,
20
+ ...props
21
+ }: Props,
16
22
  ref,
17
23
  ) {
18
24
  return (
19
25
  <Element
20
26
  {...props}
21
27
  ref={ref}
22
- style={{ ...style, '--circle-size': `var(--size-${size})` }}
28
+ style={{ ...style, '--circle-size': fixedSize ? `${size}px` : `var(--size-${size})` }}
23
29
  className={clsx('np-circle', 'd-flex align-items-center justify-content-center', className)}
24
30
  >
25
31
  {children}
@@ -22,11 +22,11 @@ exports[`FlowNavigation on mobile renders as expected 1`] = `
22
22
  >
23
23
  <div
24
24
  class="np-circle d-flex align-items-center justify-content-center tw-avatar tw-avatar--48 tw-avatar--initials np-text-title-body"
25
- style="--circle-size: var(--size-48);"
25
+ style="--circle-size: 48px;"
26
26
  >
27
27
  <div
28
28
  class="np-circle d-flex align-items-center justify-content-center tw-avatar__content"
29
- style="--circle-size: var(--size-48);"
29
+ style="--circle-size: 48px;"
30
30
  >
31
31
  TM
32
32
  </div>
@@ -139,11 +139,11 @@ exports[`FlowNavigation renders as expected 1`] = `
139
139
  >
140
140
  <div
141
141
  class="np-circle d-flex align-items-center justify-content-center tw-avatar tw-avatar--48 tw-avatar--initials np-text-title-body"
142
- style="--circle-size: var(--size-48);"
142
+ style="--circle-size: 48px;"
143
143
  >
144
144
  <div
145
145
  class="np-circle d-flex align-items-center justify-content-center tw-avatar__content"
146
- style="--circle-size: var(--size-48);"
146
+ style="--circle-size: 48px;"
147
147
  >
148
148
  TM
149
149
  </div>
@@ -19,11 +19,11 @@ exports[`OverlayHeader renders as expected 1`] = `
19
19
  >
20
20
  <div
21
21
  class="np-circle d-flex align-items-center justify-content-center tw-avatar tw-avatar--48 tw-avatar--initials np-text-title-body"
22
- style="--circle-size: var(--size-48);"
22
+ style="--circle-size: 48px;"
23
23
  >
24
24
  <div
25
25
  class="np-circle d-flex align-items-center justify-content-center tw-avatar__content"
26
- style="--circle-size: var(--size-48);"
26
+ style="--circle-size: 48px;"
27
27
  >
28
28
  TM
29
29
  </div>
@@ -35,11 +35,11 @@ exports[`Radio shows the avatar when supplied 1`] = `
35
35
  >
36
36
  <div
37
37
  class="np-circle d-flex align-items-center justify-content-center tw-avatar tw-avatar--48 tw-avatar--initials np-text-title-body"
38
- style="--circle-size: var(--size-48);"
38
+ style="--circle-size: 48px;"
39
39
  >
40
40
  <div
41
41
  class="np-circle d-flex align-items-center justify-content-center tw-avatar__content"
42
- style="--circle-size: var(--size-48);"
42
+ style="--circle-size: 48px;"
43
43
  >
44
44
  HD
45
45
  </div>