@transferwise/components 0.0.0-experimental-1a9f157 → 0.0.0-experimental-2975c15

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.
Files changed (72) hide show
  1. package/build/alert/Alert.js +12 -3
  2. package/build/alert/Alert.js.map +1 -1
  3. package/build/alert/Alert.mjs +12 -3
  4. package/build/alert/Alert.mjs.map +1 -1
  5. package/build/avatar/Avatar.js +0 -2
  6. package/build/avatar/Avatar.js.map +1 -1
  7. package/build/avatar/Avatar.mjs +0 -2
  8. package/build/avatar/Avatar.mjs.map +1 -1
  9. package/build/badge/Badge.js +0 -1
  10. package/build/badge/Badge.js.map +1 -1
  11. package/build/badge/Badge.mjs +0 -1
  12. package/build/badge/Badge.mjs.map +1 -1
  13. package/build/circularButton/CircularButton.js +1 -1
  14. package/build/circularButton/CircularButton.js.map +1 -1
  15. package/build/circularButton/CircularButton.mjs +1 -1
  16. package/build/circularButton/CircularButton.mjs.map +1 -1
  17. package/build/common/circle/Circle.js +3 -19
  18. package/build/common/circle/Circle.js.map +1 -1
  19. package/build/common/circle/Circle.mjs +3 -19
  20. package/build/common/circle/Circle.mjs.map +1 -1
  21. package/build/common/constants.js +15 -0
  22. package/build/common/constants.js.map +1 -0
  23. package/build/common/constants.mjs +13 -0
  24. package/build/common/constants.mjs.map +1 -0
  25. package/build/main.css +22 -6
  26. package/build/statusIcon/StatusIcon.js +4 -4
  27. package/build/statusIcon/StatusIcon.js.map +1 -1
  28. package/build/statusIcon/StatusIcon.mjs +4 -4
  29. package/build/statusIcon/StatusIcon.mjs.map +1 -1
  30. package/build/styles/circularButton/CircularButton.css +2 -2
  31. package/build/styles/common/circle/Circle.css +0 -4
  32. package/build/styles/main.css +22 -6
  33. package/build/styles/statusIcon/StatusIcon.css +20 -0
  34. package/build/types/alert/Alert.d.ts.map +1 -1
  35. package/build/types/avatar/Avatar.d.ts.map +1 -1
  36. package/build/types/common/circle/Circle.d.ts +1 -9
  37. package/build/types/common/circle/Circle.d.ts.map +1 -1
  38. package/build/types/common/constants.d.ts +11 -0
  39. package/build/types/common/constants.d.ts.map +1 -0
  40. package/build/types/common/index.d.ts +2 -0
  41. package/build/types/statusIcon/StatusIcon.d.ts +2 -6
  42. package/build/types/statusIcon/StatusIcon.d.ts.map +1 -1
  43. package/package.json +3 -3
  44. package/src/alert/Alert.spec.story.tsx +87 -0
  45. package/src/alert/Alert.story.tsx +36 -6
  46. package/src/alert/Alert.tsx +20 -4
  47. package/src/avatar/Avatar.spec.tsx +1 -3
  48. package/src/avatar/Avatar.tsx +0 -2
  49. package/src/avatarWrapper/__snapshots__/AvatarWrapper.spec.tsx.snap +11 -11
  50. package/src/badge/Badge.spec.tsx +1 -3
  51. package/src/badge/Badge.tsx +1 -1
  52. package/src/circularButton/CircularButton.css +2 -2
  53. package/src/circularButton/CircularButton.less +1 -1
  54. package/src/circularButton/CircularButton.tsx +1 -1
  55. package/src/circularButton/__snapshots__/CircularButton.spec.tsx.snap +20 -20
  56. package/src/common/circle/Circle.css +0 -4
  57. package/src/common/circle/Circle.less +0 -8
  58. package/src/common/circle/Circle.tsx +3 -36
  59. package/src/common/constants.ts +11 -0
  60. package/src/common/index.js +2 -0
  61. package/src/flowNavigation/__snapshots__/FlowNavigation.spec.js.snap +4 -4
  62. package/src/main.css +22 -6
  63. package/src/overlayHeader/OverlayHeader.spec.tsx +1 -3
  64. package/src/overlayHeader/__snapshots__/OverlayHeader.spec.tsx.snap +2 -2
  65. package/src/promoCard/PromoCard.spec.tsx +1 -3
  66. package/src/radio/Radio.rtl.spec.tsx +1 -2
  67. package/src/radio/__snapshots__/Radio.rtl.spec.tsx.snap +2 -2
  68. package/src/statusIcon/StatusIcon.css +20 -0
  69. package/src/statusIcon/StatusIcon.less +17 -0
  70. package/src/statusIcon/StatusIcon.spec.tsx +21 -3
  71. package/src/statusIcon/StatusIcon.story.tsx +8 -31
  72. package/src/statusIcon/StatusIcon.tsx +6 -11
package/build/main.css CHANGED
@@ -1013,8 +1013,8 @@ div.critical-comms .critical-comms-body {
1013
1013
  }
1014
1014
  @media (max-width: 320px) {
1015
1015
  .np-circular-btn .tw-icon {
1016
- top: 12px;
1017
- top: var(--size-12);
1016
+ top: 8px;
1017
+ top: var(--size-8);
1018
1018
  }
1019
1019
  }
1020
1020
  .np-circular-btn .tw-icon > svg {
@@ -1169,10 +1169,6 @@ div.critical-comms .critical-comms-body {
1169
1169
  height: var(--circle-size);
1170
1170
  flex-shrink: 0;
1171
1171
  }
1172
- .np-circle-icons-size .tw-icon > svg {
1173
- height: var(--circle-icon-size);
1174
- width: var(--circle-icon-size);
1175
- }
1176
1172
  .np-bottom-sheet {
1177
1173
  border-radius: 10px 10px 0 0;
1178
1174
  }
@@ -4159,6 +4155,12 @@ html:not([dir="rtl"]) .np-navigation-option {
4159
4155
  transform: translateY(-24px);
4160
4156
  }
4161
4157
  }
4158
+ .status-icon > svg {
4159
+ height: 32px;
4160
+ height: var(--size-32);
4161
+ width: 32px;
4162
+ width: var(--size-32);
4163
+ }
4162
4164
  .status-circle .light {
4163
4165
  color: var(--color-contrast);
4164
4166
  }
@@ -4174,6 +4176,20 @@ html:not([dir="rtl"]) .np-navigation-option {
4174
4176
  .np-theme-personal .status-circle.pending .status-icon {
4175
4177
  color: var(--color-dark);
4176
4178
  }
4179
+ .status-circle-sm .status-icon > svg {
4180
+ height: 14px;
4181
+ height: var(--size-14);
4182
+ width: 14px;
4183
+ width: var(--size-14);
4184
+ }
4185
+ @media (max-width: 320px) {
4186
+ .status-circle-sm .status-icon > svg {
4187
+ width: 24px;
4188
+ width: var(--size-24);
4189
+ height: 24px;
4190
+ height: var(--size-24);
4191
+ }
4192
+ }
4177
4193
  .status-circle.negative,
4178
4194
  .status-circle.error {
4179
4195
  background-color: var(--color-sentiment-negative);
@@ -25,17 +25,17 @@ const mapLegacySize = {
25
25
  };
26
26
  const StatusIcon = ({
27
27
  sentiment = 'neutral',
28
- size: sizeProp = 40
28
+ size: sizeProp = 'md'
29
29
  }) => {
30
30
  const Icon = iconTypeMap[sentiment];
31
31
  const iconColor = sentiment === 'warning' || sentiment === 'pending' ? 'dark' : 'light';
32
32
  const isTinyViewport = useMedia.useMedia(`(max-width: ${breakpoint.Breakpoint.ZOOM_400}px)`);
33
- const size = mapLegacySize[sizeProp] ?? sizeProp;
33
+ const size$1 = sizeProp === size.Size.SMALL && isTinyViewport ? 32 : mapLegacySize[sizeProp];
34
34
  return /*#__PURE__*/jsxRuntime.jsx(Circle, {
35
35
  as: "span",
36
- size: isTinyViewport && size < 40 ? 32 : size,
36
+ size: size$1,
37
37
  "data-testid": "status-icon",
38
- className: clsx.clsx('status-circle', sentiment),
38
+ className: clsx.clsx('status-circle', `status-circle-${sizeProp}`, sentiment),
39
39
  children: /*#__PURE__*/jsxRuntime.jsx(Icon, {
40
40
  className: clsx.clsx('status-icon', iconColor)
41
41
  })
@@ -1 +1 @@
1
- {"version":3,"file":"StatusIcon.js","sources":["../../src/statusIcon/StatusIcon.tsx"],"sourcesContent":["import { Info, Alert, Cross, Check, ClockBorderless } from '@transferwise/icons';\nimport { clsx } from 'clsx';\n\nimport { SizeSmall, SizeMedium, SizeLarge, Sentiment, Size, Breakpoint } from '../common';\nimport Circle, { CircleProps } from '../common/circle';\nimport { useMedia } from '../common/hooks/useMedia';\n\n/**\n * @deprecated use `16 | 24 | 32 | 40 | 48 | 56 | 72` component instead\n */\ntype LegacySizes = SizeSmall | SizeMedium | SizeLarge;\n\nexport type StatusIconProps = {\n sentiment?: `${Sentiment}`;\n size?: LegacySizes | 16 | 24 | 32 | 40 | 48 | 56 | 72;\n};\n\nconst iconTypeMap = {\n positive: Check,\n neutral: Info,\n warning: Alert,\n negative: Cross,\n pending: ClockBorderless,\n info: Info,\n error: Cross,\n success: Check,\n} satisfies Record<`${Sentiment}`, React.ElementType>;\n\nconst mapLegacySize = {\n [String(Size.SMALL)]: 16,\n [String(Size.MEDIUM)]: 40,\n [String(Size.LARGE)]: 48,\n} satisfies Record<string, CircleProps['size']>;\n\nconst StatusIcon = ({ sentiment = 'neutral', size: sizeProp = 40 }: StatusIconProps) => {\n const Icon = iconTypeMap[sentiment];\n const iconColor = sentiment === 'warning' || sentiment === 'pending' ? 'dark' : 'light';\n const isTinyViewport = useMedia(`(max-width: ${Breakpoint.ZOOM_400}px)`);\n const size = mapLegacySize[sizeProp] ?? sizeProp;\n return (\n <Circle\n as=\"span\"\n size={isTinyViewport && size < 40 ? 32 : size}\n data-testid=\"status-icon\"\n className={clsx('status-circle', sentiment)}\n >\n <Icon className={clsx('status-icon', iconColor)} />\n </Circle>\n );\n};\n\nexport default StatusIcon;\n"],"names":["iconTypeMap","positive","Check","neutral","Info","warning","Alert","negative","Cross","pending","ClockBorderless","info","error","success","mapLegacySize","String","Size","SMALL","MEDIUM","LARGE","StatusIcon","sentiment","size","sizeProp","Icon","iconColor","isTinyViewport","useMedia","Breakpoint","ZOOM_400","_jsx","Circle","as","className","clsx","children"],"mappings":";;;;;;;;;;AAiBA,MAAMA,WAAW,GAAG;AAClBC,EAAAA,QAAQ,EAAEC,WAAK;AACfC,EAAAA,OAAO,EAAEC,UAAI;AACbC,EAAAA,OAAO,EAAEC,WAAK;AACdC,EAAAA,QAAQ,EAAEC,WAAK;AACfC,EAAAA,OAAO,EAAEC,qBAAe;AACxBC,EAAAA,IAAI,EAAEP,UAAI;AACVQ,EAAAA,KAAK,EAAEJ,WAAK;AACZK,EAAAA,OAAO,EAAEX,WAAAA;CAC0C,CAAA;AAErD,MAAMY,aAAa,GAAG;AACpB,EAAA,CAACC,MAAM,CAACC,SAAI,CAACC,KAAK,CAAC,GAAG,EAAE;AACxB,EAAA,CAACF,MAAM,CAACC,SAAI,CAACE,MAAM,CAAC,GAAG,EAAE;AACzB,EAAA,CAACH,MAAM,CAACC,SAAI,CAACG,KAAK,CAAC,GAAG,EAAA;CACuB,CAAA;AAEzCC,MAAAA,UAAU,GAAGA,CAAC;AAAEC,EAAAA,SAAS,GAAG,SAAS;EAAEC,IAAI,EAAEC,QAAQ,GAAG,EAAA;AAAE,CAAmB,KAAI;AACrF,EAAA,MAAMC,IAAI,GAAGxB,WAAW,CAACqB,SAAS,CAAC,CAAA;AACnC,EAAA,MAAMI,SAAS,GAAGJ,SAAS,KAAK,SAAS,IAAIA,SAAS,KAAK,SAAS,GAAG,MAAM,GAAG,OAAO,CAAA;EACvF,MAAMK,cAAc,GAAGC,iBAAQ,CAAC,eAAeC,qBAAU,CAACC,QAAQ,CAAA,GAAA,CAAK,CAAC,CAAA;AACxE,EAAA,MAAMP,IAAI,GAAGR,aAAa,CAACS,QAAQ,CAAC,IAAIA,QAAQ,CAAA;EAChD,oBACEO,cAAA,CAACC,MAAM,EAAA;AACLC,IAAAA,EAAE,EAAC,MAAM;IACTV,IAAI,EAAEI,cAAc,IAAIJ,IAAI,GAAG,EAAE,GAAG,EAAE,GAAGA,IAAK;AAC9C,IAAA,aAAA,EAAY,aAAa;AACzBW,IAAAA,SAAS,EAAEC,SAAI,CAAC,eAAe,EAAEb,SAAS,CAAE;IAAAc,QAAA,eAE5CL,cAAA,CAACN,IAAI,EAAA;AAACS,MAAAA,SAAS,EAAEC,SAAI,CAAC,aAAa,EAAET,SAAS,CAAA;KAChD,CAAA;AAAA,GAAQ,CAAC,CAAA;AAEb;;;;"}
1
+ {"version":3,"file":"StatusIcon.js","sources":["../../src/statusIcon/StatusIcon.tsx"],"sourcesContent":["import { Info, Alert, Cross, Check, ClockBorderless } from '@transferwise/icons';\nimport { clsx } from 'clsx';\n\nimport { SizeSmall, SizeMedium, SizeLarge, Sentiment, Size, Breakpoint } from '../common';\nimport Circle, { CircleProps } from '../common/circle';\nimport { useMedia } from '../common/hooks/useMedia';\n\nexport type StatusIconProps = {\n sentiment: `${Sentiment}`;\n size: SizeSmall | SizeMedium | SizeLarge;\n};\n\nconst iconTypeMap = {\n positive: Check,\n neutral: Info,\n warning: Alert,\n negative: Cross,\n pending: ClockBorderless,\n info: Info,\n error: Cross,\n success: Check,\n} satisfies Record<`${Sentiment}`, React.ElementType>;\n\nconst mapLegacySize = {\n [String(Size.SMALL)]: 16,\n [String(Size.MEDIUM)]: 40,\n [String(Size.LARGE)]: 48,\n} satisfies Record<string, CircleProps['size']>;\n\nconst StatusIcon = ({ sentiment = 'neutral', size: sizeProp = 'md' }: StatusIconProps) => {\n const Icon = iconTypeMap[sentiment];\n const iconColor = sentiment === 'warning' || sentiment === 'pending' ? 'dark' : 'light';\n const isTinyViewport = useMedia(`(max-width: ${Breakpoint.ZOOM_400}px)`);\n const size = sizeProp === Size.SMALL && isTinyViewport ? 32 : mapLegacySize[sizeProp];\n return (\n <Circle\n as=\"span\"\n size={size}\n data-testid=\"status-icon\"\n className={clsx('status-circle', `status-circle-${sizeProp}`, sentiment)}\n >\n <Icon className={clsx('status-icon', iconColor)} />\n </Circle>\n );\n};\n\nexport default StatusIcon;\n"],"names":["iconTypeMap","positive","Check","neutral","Info","warning","Alert","negative","Cross","pending","ClockBorderless","info","error","success","mapLegacySize","String","Size","SMALL","MEDIUM","LARGE","StatusIcon","sentiment","size","sizeProp","Icon","iconColor","isTinyViewport","useMedia","Breakpoint","ZOOM_400","_jsx","Circle","as","className","clsx","children"],"mappings":";;;;;;;;;;AAYA,MAAMA,WAAW,GAAG;AAClBC,EAAAA,QAAQ,EAAEC,WAAK;AACfC,EAAAA,OAAO,EAAEC,UAAI;AACbC,EAAAA,OAAO,EAAEC,WAAK;AACdC,EAAAA,QAAQ,EAAEC,WAAK;AACfC,EAAAA,OAAO,EAAEC,qBAAe;AACxBC,EAAAA,IAAI,EAAEP,UAAI;AACVQ,EAAAA,KAAK,EAAEJ,WAAK;AACZK,EAAAA,OAAO,EAAEX,WAAAA;CAC0C,CAAA;AAErD,MAAMY,aAAa,GAAG;AACpB,EAAA,CAACC,MAAM,CAACC,SAAI,CAACC,KAAK,CAAC,GAAG,EAAE;AACxB,EAAA,CAACF,MAAM,CAACC,SAAI,CAACE,MAAM,CAAC,GAAG,EAAE;AACzB,EAAA,CAACH,MAAM,CAACC,SAAI,CAACG,KAAK,CAAC,GAAG,EAAA;CACuB,CAAA;AAEzCC,MAAAA,UAAU,GAAGA,CAAC;AAAEC,EAAAA,SAAS,GAAG,SAAS;EAAEC,IAAI,EAAEC,QAAQ,GAAG,IAAA;AAAI,CAAmB,KAAI;AACvF,EAAA,MAAMC,IAAI,GAAGxB,WAAW,CAACqB,SAAS,CAAC,CAAA;AACnC,EAAA,MAAMI,SAAS,GAAGJ,SAAS,KAAK,SAAS,IAAIA,SAAS,KAAK,SAAS,GAAG,MAAM,GAAG,OAAO,CAAA;EACvF,MAAMK,cAAc,GAAGC,iBAAQ,CAAC,eAAeC,qBAAU,CAACC,QAAQ,CAAA,GAAA,CAAK,CAAC,CAAA;AACxE,EAAA,MAAMP,MAAI,GAAGC,QAAQ,KAAKP,SAAI,CAACC,KAAK,IAAIS,cAAc,GAAG,EAAE,GAAGZ,aAAa,CAACS,QAAQ,CAAC,CAAA;EACrF,oBACEO,cAAA,CAACC,MAAM,EAAA;AACLC,IAAAA,EAAE,EAAC,MAAM;AACTV,IAAAA,IAAI,EAAEA,MAAK;AACX,IAAA,aAAA,EAAY,aAAa;IACzBW,SAAS,EAAEC,SAAI,CAAC,eAAe,EAAE,iBAAiBX,QAAQ,CAAA,CAAE,EAAEF,SAAS,CAAE;IAAAc,QAAA,eAEzEL,cAAA,CAACN,IAAI,EAAA;AAACS,MAAAA,SAAS,EAAEC,SAAI,CAAC,aAAa,EAAET,SAAS,CAAA;KAChD,CAAA;AAAA,GAAQ,CAAC,CAAA;AAEb;;;;"}
@@ -23,17 +23,17 @@ const mapLegacySize = {
23
23
  };
24
24
  const StatusIcon = ({
25
25
  sentiment = 'neutral',
26
- size: sizeProp = 40
26
+ size: sizeProp = 'md'
27
27
  }) => {
28
28
  const Icon = iconTypeMap[sentiment];
29
29
  const iconColor = sentiment === 'warning' || sentiment === 'pending' ? 'dark' : 'light';
30
30
  const isTinyViewport = useMedia(`(max-width: ${Breakpoint.ZOOM_400}px)`);
31
- const size = mapLegacySize[sizeProp] ?? sizeProp;
31
+ const size = sizeProp === Size.SMALL && isTinyViewport ? 32 : mapLegacySize[sizeProp];
32
32
  return /*#__PURE__*/jsx(Circle, {
33
33
  as: "span",
34
- size: isTinyViewport && size < 40 ? 32 : size,
34
+ size: size,
35
35
  "data-testid": "status-icon",
36
- className: clsx('status-circle', sentiment),
36
+ className: clsx('status-circle', `status-circle-${sizeProp}`, sentiment),
37
37
  children: /*#__PURE__*/jsx(Icon, {
38
38
  className: clsx('status-icon', iconColor)
39
39
  })
@@ -1 +1 @@
1
- {"version":3,"file":"StatusIcon.mjs","sources":["../../src/statusIcon/StatusIcon.tsx"],"sourcesContent":["import { Info, Alert, Cross, Check, ClockBorderless } from '@transferwise/icons';\nimport { clsx } from 'clsx';\n\nimport { SizeSmall, SizeMedium, SizeLarge, Sentiment, Size, Breakpoint } from '../common';\nimport Circle, { CircleProps } from '../common/circle';\nimport { useMedia } from '../common/hooks/useMedia';\n\n/**\n * @deprecated use `16 | 24 | 32 | 40 | 48 | 56 | 72` component instead\n */\ntype LegacySizes = SizeSmall | SizeMedium | SizeLarge;\n\nexport type StatusIconProps = {\n sentiment?: `${Sentiment}`;\n size?: LegacySizes | 16 | 24 | 32 | 40 | 48 | 56 | 72;\n};\n\nconst iconTypeMap = {\n positive: Check,\n neutral: Info,\n warning: Alert,\n negative: Cross,\n pending: ClockBorderless,\n info: Info,\n error: Cross,\n success: Check,\n} satisfies Record<`${Sentiment}`, React.ElementType>;\n\nconst mapLegacySize = {\n [String(Size.SMALL)]: 16,\n [String(Size.MEDIUM)]: 40,\n [String(Size.LARGE)]: 48,\n} satisfies Record<string, CircleProps['size']>;\n\nconst StatusIcon = ({ sentiment = 'neutral', size: sizeProp = 40 }: StatusIconProps) => {\n const Icon = iconTypeMap[sentiment];\n const iconColor = sentiment === 'warning' || sentiment === 'pending' ? 'dark' : 'light';\n const isTinyViewport = useMedia(`(max-width: ${Breakpoint.ZOOM_400}px)`);\n const size = mapLegacySize[sizeProp] ?? sizeProp;\n return (\n <Circle\n as=\"span\"\n size={isTinyViewport && size < 40 ? 32 : size}\n data-testid=\"status-icon\"\n className={clsx('status-circle', sentiment)}\n >\n <Icon className={clsx('status-icon', iconColor)} />\n </Circle>\n );\n};\n\nexport default StatusIcon;\n"],"names":["iconTypeMap","positive","Check","neutral","Info","warning","Alert","negative","Cross","pending","ClockBorderless","info","error","success","mapLegacySize","String","Size","SMALL","MEDIUM","LARGE","StatusIcon","sentiment","size","sizeProp","Icon","iconColor","isTinyViewport","useMedia","Breakpoint","ZOOM_400","_jsx","Circle","as","className","clsx","children"],"mappings":";;;;;;;;AAiBA,MAAMA,WAAW,GAAG;AAClBC,EAAAA,QAAQ,EAAEC,KAAK;AACfC,EAAAA,OAAO,EAAEC,IAAI;AACbC,EAAAA,OAAO,EAAEC,KAAK;AACdC,EAAAA,QAAQ,EAAEC,KAAK;AACfC,EAAAA,OAAO,EAAEC,eAAe;AACxBC,EAAAA,IAAI,EAAEP,IAAI;AACVQ,EAAAA,KAAK,EAAEJ,KAAK;AACZK,EAAAA,OAAO,EAAEX,KAAAA;CAC0C,CAAA;AAErD,MAAMY,aAAa,GAAG;AACpB,EAAA,CAACC,MAAM,CAACC,IAAI,CAACC,KAAK,CAAC,GAAG,EAAE;AACxB,EAAA,CAACF,MAAM,CAACC,IAAI,CAACE,MAAM,CAAC,GAAG,EAAE;AACzB,EAAA,CAACH,MAAM,CAACC,IAAI,CAACG,KAAK,CAAC,GAAG,EAAA;CACuB,CAAA;AAEzCC,MAAAA,UAAU,GAAGA,CAAC;AAAEC,EAAAA,SAAS,GAAG,SAAS;EAAEC,IAAI,EAAEC,QAAQ,GAAG,EAAA;AAAE,CAAmB,KAAI;AACrF,EAAA,MAAMC,IAAI,GAAGxB,WAAW,CAACqB,SAAS,CAAC,CAAA;AACnC,EAAA,MAAMI,SAAS,GAAGJ,SAAS,KAAK,SAAS,IAAIA,SAAS,KAAK,SAAS,GAAG,MAAM,GAAG,OAAO,CAAA;EACvF,MAAMK,cAAc,GAAGC,QAAQ,CAAC,eAAeC,UAAU,CAACC,QAAQ,CAAA,GAAA,CAAK,CAAC,CAAA;AACxE,EAAA,MAAMP,IAAI,GAAGR,aAAa,CAACS,QAAQ,CAAC,IAAIA,QAAQ,CAAA;EAChD,oBACEO,GAAA,CAACC,MAAM,EAAA;AACLC,IAAAA,EAAE,EAAC,MAAM;IACTV,IAAI,EAAEI,cAAc,IAAIJ,IAAI,GAAG,EAAE,GAAG,EAAE,GAAGA,IAAK;AAC9C,IAAA,aAAA,EAAY,aAAa;AACzBW,IAAAA,SAAS,EAAEC,IAAI,CAAC,eAAe,EAAEb,SAAS,CAAE;IAAAc,QAAA,eAE5CL,GAAA,CAACN,IAAI,EAAA;AAACS,MAAAA,SAAS,EAAEC,IAAI,CAAC,aAAa,EAAET,SAAS,CAAA;KAChD,CAAA;AAAA,GAAQ,CAAC,CAAA;AAEb;;;;"}
1
+ {"version":3,"file":"StatusIcon.mjs","sources":["../../src/statusIcon/StatusIcon.tsx"],"sourcesContent":["import { Info, Alert, Cross, Check, ClockBorderless } from '@transferwise/icons';\nimport { clsx } from 'clsx';\n\nimport { SizeSmall, SizeMedium, SizeLarge, Sentiment, Size, Breakpoint } from '../common';\nimport Circle, { CircleProps } from '../common/circle';\nimport { useMedia } from '../common/hooks/useMedia';\n\nexport type StatusIconProps = {\n sentiment: `${Sentiment}`;\n size: SizeSmall | SizeMedium | SizeLarge;\n};\n\nconst iconTypeMap = {\n positive: Check,\n neutral: Info,\n warning: Alert,\n negative: Cross,\n pending: ClockBorderless,\n info: Info,\n error: Cross,\n success: Check,\n} satisfies Record<`${Sentiment}`, React.ElementType>;\n\nconst mapLegacySize = {\n [String(Size.SMALL)]: 16,\n [String(Size.MEDIUM)]: 40,\n [String(Size.LARGE)]: 48,\n} satisfies Record<string, CircleProps['size']>;\n\nconst StatusIcon = ({ sentiment = 'neutral', size: sizeProp = 'md' }: StatusIconProps) => {\n const Icon = iconTypeMap[sentiment];\n const iconColor = sentiment === 'warning' || sentiment === 'pending' ? 'dark' : 'light';\n const isTinyViewport = useMedia(`(max-width: ${Breakpoint.ZOOM_400}px)`);\n const size = sizeProp === Size.SMALL && isTinyViewport ? 32 : mapLegacySize[sizeProp];\n return (\n <Circle\n as=\"span\"\n size={size}\n data-testid=\"status-icon\"\n className={clsx('status-circle', `status-circle-${sizeProp}`, sentiment)}\n >\n <Icon className={clsx('status-icon', iconColor)} />\n </Circle>\n );\n};\n\nexport default StatusIcon;\n"],"names":["iconTypeMap","positive","Check","neutral","Info","warning","Alert","negative","Cross","pending","ClockBorderless","info","error","success","mapLegacySize","String","Size","SMALL","MEDIUM","LARGE","StatusIcon","sentiment","size","sizeProp","Icon","iconColor","isTinyViewport","useMedia","Breakpoint","ZOOM_400","_jsx","Circle","as","className","clsx","children"],"mappings":";;;;;;;;AAYA,MAAMA,WAAW,GAAG;AAClBC,EAAAA,QAAQ,EAAEC,KAAK;AACfC,EAAAA,OAAO,EAAEC,IAAI;AACbC,EAAAA,OAAO,EAAEC,KAAK;AACdC,EAAAA,QAAQ,EAAEC,KAAK;AACfC,EAAAA,OAAO,EAAEC,eAAe;AACxBC,EAAAA,IAAI,EAAEP,IAAI;AACVQ,EAAAA,KAAK,EAAEJ,KAAK;AACZK,EAAAA,OAAO,EAAEX,KAAAA;CAC0C,CAAA;AAErD,MAAMY,aAAa,GAAG;AACpB,EAAA,CAACC,MAAM,CAACC,IAAI,CAACC,KAAK,CAAC,GAAG,EAAE;AACxB,EAAA,CAACF,MAAM,CAACC,IAAI,CAACE,MAAM,CAAC,GAAG,EAAE;AACzB,EAAA,CAACH,MAAM,CAACC,IAAI,CAACG,KAAK,CAAC,GAAG,EAAA;CACuB,CAAA;AAEzCC,MAAAA,UAAU,GAAGA,CAAC;AAAEC,EAAAA,SAAS,GAAG,SAAS;EAAEC,IAAI,EAAEC,QAAQ,GAAG,IAAA;AAAI,CAAmB,KAAI;AACvF,EAAA,MAAMC,IAAI,GAAGxB,WAAW,CAACqB,SAAS,CAAC,CAAA;AACnC,EAAA,MAAMI,SAAS,GAAGJ,SAAS,KAAK,SAAS,IAAIA,SAAS,KAAK,SAAS,GAAG,MAAM,GAAG,OAAO,CAAA;EACvF,MAAMK,cAAc,GAAGC,QAAQ,CAAC,eAAeC,UAAU,CAACC,QAAQ,CAAA,GAAA,CAAK,CAAC,CAAA;AACxE,EAAA,MAAMP,IAAI,GAAGC,QAAQ,KAAKP,IAAI,CAACC,KAAK,IAAIS,cAAc,GAAG,EAAE,GAAGZ,aAAa,CAACS,QAAQ,CAAC,CAAA;EACrF,oBACEO,GAAA,CAACC,MAAM,EAAA;AACLC,IAAAA,EAAE,EAAC,MAAM;AACTV,IAAAA,IAAI,EAAEA,IAAK;AACX,IAAA,aAAA,EAAY,aAAa;IACzBW,SAAS,EAAEC,IAAI,CAAC,eAAe,EAAE,iBAAiBX,QAAQ,CAAA,CAAE,EAAEF,SAAS,CAAE;IAAAc,QAAA,eAEzEL,GAAA,CAACN,IAAI,EAAA;AAACS,MAAAA,SAAS,EAAEC,IAAI,CAAC,aAAa,EAAET,SAAS,CAAA;KAChD,CAAA;AAAA,GAAQ,CAAC,CAAA;AAEb;;;;"}
@@ -23,8 +23,8 @@
23
23
  }
24
24
  @media (max-width: 320px) {
25
25
  .np-circular-btn .tw-icon {
26
- top: 12px;
27
- top: var(--size-12);
26
+ top: 8px;
27
+ top: var(--size-8);
28
28
  }
29
29
  }
30
30
  .np-circular-btn .tw-icon > svg {
@@ -5,7 +5,3 @@
5
5
  height: var(--circle-size);
6
6
  flex-shrink: 0;
7
7
  }
8
- .np-circle-icons-size .tw-icon > svg {
9
- height: var(--circle-icon-size);
10
- width: var(--circle-icon-size);
11
- }
@@ -1013,8 +1013,8 @@ div.critical-comms .critical-comms-body {
1013
1013
  }
1014
1014
  @media (max-width: 320px) {
1015
1015
  .np-circular-btn .tw-icon {
1016
- top: 12px;
1017
- top: var(--size-12);
1016
+ top: 8px;
1017
+ top: var(--size-8);
1018
1018
  }
1019
1019
  }
1020
1020
  .np-circular-btn .tw-icon > svg {
@@ -1169,10 +1169,6 @@ div.critical-comms .critical-comms-body {
1169
1169
  height: var(--circle-size);
1170
1170
  flex-shrink: 0;
1171
1171
  }
1172
- .np-circle-icons-size .tw-icon > svg {
1173
- height: var(--circle-icon-size);
1174
- width: var(--circle-icon-size);
1175
- }
1176
1172
  .np-bottom-sheet {
1177
1173
  border-radius: 10px 10px 0 0;
1178
1174
  }
@@ -4159,6 +4155,12 @@ html:not([dir="rtl"]) .np-navigation-option {
4159
4155
  transform: translateY(-24px);
4160
4156
  }
4161
4157
  }
4158
+ .status-icon > svg {
4159
+ height: 32px;
4160
+ height: var(--size-32);
4161
+ width: 32px;
4162
+ width: var(--size-32);
4163
+ }
4162
4164
  .status-circle .light {
4163
4165
  color: var(--color-contrast);
4164
4166
  }
@@ -4174,6 +4176,20 @@ html:not([dir="rtl"]) .np-navigation-option {
4174
4176
  .np-theme-personal .status-circle.pending .status-icon {
4175
4177
  color: var(--color-dark);
4176
4178
  }
4179
+ .status-circle-sm .status-icon > svg {
4180
+ height: 14px;
4181
+ height: var(--size-14);
4182
+ width: 14px;
4183
+ width: var(--size-14);
4184
+ }
4185
+ @media (max-width: 320px) {
4186
+ .status-circle-sm .status-icon > svg {
4187
+ width: 24px;
4188
+ width: var(--size-24);
4189
+ height: 24px;
4190
+ height: var(--size-24);
4191
+ }
4192
+ }
4177
4193
  .status-circle.negative,
4178
4194
  .status-circle.error {
4179
4195
  background-color: var(--color-sentiment-negative);
@@ -1,3 +1,9 @@
1
+ .status-icon > svg {
2
+ height: 32px;
3
+ height: var(--size-32);
4
+ width: 32px;
5
+ width: var(--size-32);
6
+ }
1
7
  .status-circle .light {
2
8
  color: var(--color-contrast);
3
9
  }
@@ -13,6 +19,20 @@
13
19
  .np-theme-personal .status-circle.pending .status-icon {
14
20
  color: var(--color-dark);
15
21
  }
22
+ .status-circle-sm .status-icon > svg {
23
+ height: 14px;
24
+ height: var(--size-14);
25
+ width: 14px;
26
+ width: var(--size-14);
27
+ }
28
+ @media (max-width: 320px) {
29
+ .status-circle-sm .status-icon > svg {
30
+ width: 24px;
31
+ width: var(--size-24);
32
+ height: 24px;
33
+ height: var(--size-24);
34
+ }
35
+ }
16
36
  .status-circle.negative,
17
37
  .status-circle.error {
18
38
  background-color: var(--color-sentiment-negative);
@@ -1 +1 @@
1
- {"version":3,"file":"Alert.d.ts","sourceRoot":"","sources":["../../../src/alert/Alert.tsx"],"names":[],"mappings":"AAIA,OAAO,EAAE,SAAS,EAAE,IAAI,EAAc,OAAO,EAAE,MAAM,WAAW,CAAC;AASjE,MAAM,MAAM,WAAW,GAAG;IACxB,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,IAAI,EAAE,KAAK,CAAC,SAAS,CAAC;IACtB,OAAO,CAAC,EAAE,MAAM,IAAI,CAAC;CACtB,CAAC;AAEF,kDAAkD;AAClD,KAAK,mBAAmB,GAAG,GAAG,SAAS,CAAC,OAAO,GAAG,SAAS,CAAC,IAAI,GAAG,SAAS,CAAC,KAAK,EAAE,CAAC;AACrF,KAAK,iBAAiB,GAAG,GACrB,SAAS,CAAC,QAAQ,GAClB,SAAS,CAAC,OAAO,GACjB,SAAS,CAAC,OAAO,GACjB,SAAS,CAAC,QAAQ,EAAE,CAAC;AACzB,MAAM,MAAM,SAAS,GAAG,iBAAiB,GAAG,mBAAmB,CAAC;AAEhE,oBAAY,kBAAkB;IAC5B,QAAQ,YAAY;IACpB,GAAG,cAAc;IACjB,SAAS,aAAa;IACtB,WAAW,cAAc;IACzB,MAAM,gBAAgB;IACtB,YAAY,eAAe;CAC5B;AAED,MAAM,WAAW,UAAU;IACzB,yIAAyI;IACzI,MAAM,CAAC,EAAE,WAAW,CAAC;IACrB,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,wGAAwG;IACxG,IAAI,CAAC,EAAE,KAAK,CAAC,SAAS,CAAC;IACvB,oCAAoC;IACpC,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,kGAAkG;IAClG,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,4FAA4F;IAC5F,SAAS,CAAC,EAAE,KAAK,CAAC,iBAAiB,CAAC,iBAAiB,CAAC,CAAC;IACvD,2DAA2D;IAC3D,IAAI,CAAC,EAAE,SAAS,CAAC;IACjB,OAAO,CAAC,EAAE,GAAG,OAAO,EAAE,CAAC;IACvB,4LAA4L;IAC5L,MAAM,CAAC,EAAE,OAAO,CAAC;IACjB,6CAA6C;IAC7C,KAAK,CAAC,EAAE,GAAG,kBAAkB,EAAE,CAAC;IAChC,oHAAoH;IACpH,QAAQ,CAAC,EAAE,KAAK,CAAC,SAAS,CAAC;IAC3B,2CAA2C;IAC3C,WAAW,CAAC,EAAE,OAAO,CAAC;IACtB,2FAA2F;IAC3F,IAAI,CAAC,EAAE,GAAG,IAAI,EAAE,CAAC;CAClB;AAeD,MAAM,CAAC,OAAO,UAAU,KAAK,CAAC,EAC5B,KAAK,EACL,MAAM,EACN,QAAQ,EACR,SAAS,EACT,WAAW,EACX,IAAI,EACJ,SAAS,EACT,OAAO,EACP,IAAI,EACJ,KAAK,EACL,IAAgB,EAChB,OAAmB,EACnB,MAAa,GACd,EAAE,UAAU,+BAyGZ"}
1
+ {"version":3,"file":"Alert.d.ts","sourceRoot":"","sources":["../../../src/alert/Alert.tsx"],"names":[],"mappings":"AAIA,OAAO,EAEL,SAAS,EACT,IAAI,EAEJ,OAAO,EAER,MAAM,WAAW,CAAC;AASnB,MAAM,MAAM,WAAW,GAAG;IACxB,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,IAAI,EAAE,KAAK,CAAC,SAAS,CAAC;IACtB,OAAO,CAAC,EAAE,MAAM,IAAI,CAAC;CACtB,CAAC;AAEF,kDAAkD;AAClD,KAAK,mBAAmB,GAAG,GAAG,SAAS,CAAC,OAAO,GAAG,SAAS,CAAC,IAAI,GAAG,SAAS,CAAC,KAAK,EAAE,CAAC;AACrF,KAAK,iBAAiB,GAAG,GACrB,SAAS,CAAC,QAAQ,GAClB,SAAS,CAAC,OAAO,GACjB,SAAS,CAAC,OAAO,GACjB,SAAS,CAAC,QAAQ,EAAE,CAAC;AACzB,MAAM,MAAM,SAAS,GAAG,iBAAiB,GAAG,mBAAmB,CAAC;AAEhE,oBAAY,kBAAkB;IAC5B,QAAQ,YAAY;IACpB,GAAG,cAAc;IACjB,SAAS,aAAa;IACtB,WAAW,cAAc;IACzB,MAAM,gBAAgB;IACtB,YAAY,eAAe;CAC5B;AAED,MAAM,WAAW,UAAU;IACzB,yIAAyI;IACzI,MAAM,CAAC,EAAE,WAAW,CAAC;IACrB,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,wGAAwG;IACxG,IAAI,CAAC,EAAE,KAAK,CAAC,SAAS,CAAC;IACvB,oCAAoC;IACpC,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,kGAAkG;IAClG,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,4FAA4F;IAC5F,SAAS,CAAC,EAAE,KAAK,CAAC,iBAAiB,CAAC,iBAAiB,CAAC,CAAC;IACvD,2DAA2D;IAC3D,IAAI,CAAC,EAAE,SAAS,CAAC;IACjB,OAAO,CAAC,EAAE,GAAG,OAAO,EAAE,CAAC;IACvB,4LAA4L;IAC5L,MAAM,CAAC,EAAE,OAAO,CAAC;IACjB,6CAA6C;IAC7C,KAAK,CAAC,EAAE,GAAG,kBAAkB,EAAE,CAAC;IAChC,oHAAoH;IACpH,QAAQ,CAAC,EAAE,KAAK,CAAC,SAAS,CAAC;IAC3B,2CAA2C;IAC3C,WAAW,CAAC,EAAE,OAAO,CAAC;IACtB,2FAA2F;IAC3F,IAAI,CAAC,EAAE,GAAG,IAAI,EAAE,CAAC;CAClB;AAeD,MAAM,CAAC,OAAO,UAAU,KAAK,CAAC,EAC5B,KAAK,EACL,MAAM,EACN,QAAQ,EACR,SAAS,EACT,WAAW,EACX,IAAI,EACJ,SAAS,EACT,OAAO,EACP,IAAI,EACJ,KAAK,EACL,IAAgB,EAChB,OAAmB,EACnB,MAAa,GACd,EAAE,UAAU,+BAkHZ"}
@@ -1 +1 @@
1
- {"version":3,"file":"Avatar.d.ts","sourceRoot":"","sources":["../../../src/avatar/Avatar.tsx"],"names":[],"mappings":"AAOA,KAAK,iBAAiB,GAAG,EAAE,GAAG,EAAE,GAAG,EAAE,GAAG,EAAE,GAAG,EAAE,CAAC;AAEhD,KAAK,gBAAgB,GAAG,IAAI,GAAG,IAAI,GAAG,IAAI,CAAC;AAE3C,MAAM,MAAM,UAAU,GAAG,iBAAiB,GAAG,gBAAgB,CAAC;AAE9D,MAAM,MAAM,WAAW,GAAG,OAAO,GAAG,MAAM,CAAC;AAE3C,MAAM,MAAM,UAAU,GAAG,WAAW,GAAG,MAAM,GAAG,OAAO,GAAG,UAAU,CAAC;AAErE,MAAM,WAAW,WAAW;IAC1B,eAAe,CAAC,EAAE,MAAM,CAAC;IACzB,mBAAmB,CAAC,EAAE,MAAM,CAAC;IAC7B,QAAQ,CAAC,EAAE,KAAK,CAAC,SAAS,CAAC;IAC3B,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB,IAAI,CAAC,EAAE,UAAU,CAAC;IAClB,KAAK,CAAC,EAAE,WAAW,CAAC;IACpB,IAAI,CAAC,EAAE,UAAU,CAAC;IAClB,YAAY,CAAC,EAAE,MAAM,CAAC;CACvB;AAkBD,QAAA,MAAM,MAAM,EAAE,KAAK,CAAC,EAAE,CAAC,WAAW,CA8CjC,CAAC;AAEF,eAAe,MAAM,CAAC"}
1
+ {"version":3,"file":"Avatar.d.ts","sourceRoot":"","sources":["../../../src/avatar/Avatar.tsx"],"names":[],"mappings":"AAOA,KAAK,iBAAiB,GAAG,EAAE,GAAG,EAAE,GAAG,EAAE,GAAG,EAAE,GAAG,EAAE,CAAC;AAEhD,KAAK,gBAAgB,GAAG,IAAI,GAAG,IAAI,GAAG,IAAI,CAAC;AAE3C,MAAM,MAAM,UAAU,GAAG,iBAAiB,GAAG,gBAAgB,CAAC;AAE9D,MAAM,MAAM,WAAW,GAAG,OAAO,GAAG,MAAM,CAAC;AAE3C,MAAM,MAAM,UAAU,GAAG,WAAW,GAAG,MAAM,GAAG,OAAO,GAAG,UAAU,CAAC;AAErE,MAAM,WAAW,WAAW;IAC1B,eAAe,CAAC,EAAE,MAAM,CAAC;IACzB,mBAAmB,CAAC,EAAE,MAAM,CAAC;IAC7B,QAAQ,CAAC,EAAE,KAAK,CAAC,SAAS,CAAC;IAC3B,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB,IAAI,CAAC,EAAE,UAAU,CAAC;IAClB,KAAK,CAAC,EAAE,WAAW,CAAC;IACpB,IAAI,CAAC,EAAE,UAAU,CAAC;IAClB,YAAY,CAAC,EAAE,MAAM,CAAC;CACvB;AAkBD,QAAA,MAAM,MAAM,EAAE,KAAK,CAAC,EAAE,CAAC,WAAW,CA4CjC,CAAC;AAEF,eAAe,MAAM,CAAC"}
@@ -1,5 +1,5 @@
1
1
  import { HTMLAttributes } from 'react';
2
- export type ShapeSize = 16 | 24 | 32 | 40 | 48 | 56 | 72;
2
+ export type ShapeSize = 16 | 24 | 32 | 40 | 48 | 56 | 64 | 72;
3
3
  export type Props = {
4
4
  /**
5
5
  * Modify underlying element, `div` by default
@@ -14,10 +14,6 @@ export type Props = {
14
14
  * as those can be dynamic a at certain viewport sizes
15
15
  */
16
16
  fixedSize?: boolean;
17
- /**
18
- * This property is temporary, as some components (e.g legacy Avatar) doesn't need new icon sizing, we delete it at some point
19
- */
20
- iconSizing?: boolean;
21
17
  } & HTMLAttributes<HTMLDivElement>;
22
18
  declare const Circle: import("react").ForwardRefExoticComponent<{
23
19
  /**
@@ -33,10 +29,6 @@ declare const Circle: import("react").ForwardRefExoticComponent<{
33
29
  * as those can be dynamic a at certain viewport sizes
34
30
  */
35
31
  fixedSize?: boolean;
36
- /**
37
- * This property is temporary, as some components (e.g legacy Avatar) doesn't need new icon sizing, we delete it at some point
38
- */
39
- iconSizing?: boolean;
40
32
  } & HTMLAttributes<HTMLDivElement> & import("react").RefAttributes<unknown>>;
41
33
  export default Circle;
42
34
  //# 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;AAKnD,MAAM,MAAM,SAAS,GAAG,EAAE,GAAG,EAAE,GAAG,EAAE,GAAG,EAAE,GAAG,EAAE,GAAG,EAAE,GAAG,EAAE,CAAC;AAEzD,MAAM,MAAM,KAAK,GAAG;IAClB;;OAEG;IACH,EAAE,CAAC,EAAE,KAAK,CAAC,WAAW,CAAC;IACvB;;OAEG;IACH,IAAI,CAAC,EAAE,SAAS,CAAC;IACjB;;;OAGG;IACH,SAAS,CAAC,EAAE,OAAO,CAAC;IACpB;;OAEG;IACH,UAAU,CAAC,EAAE,OAAO,CAAC;CACtB,GAAG,cAAc,CAAC,cAAc,CAAC,CAAC;AAenC,QAAA,MAAM,MAAM;IAhCV;;OAEG;SACE,KAAK,CAAC,WAAW;IACtB;;OAEG;WACI,SAAS;IAChB;;;OAGG;gBACS,OAAO;IACnB;;OAEG;iBACU,OAAO;4EAoDpB,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;;OAEG;IACH,EAAE,CAAC,EAAE,KAAK,CAAC,WAAW,CAAC;IACvB;;OAEG;IACH,IAAI,CAAC,EAAE,SAAS,CAAC;IACjB;;;OAGG;IACH,SAAS,CAAC,EAAE,OAAO,CAAC;CACrB,GAAG,cAAc,CAAC,cAAc,CAAC,CAAC;AAEnC,QAAA,MAAM,MAAM;IAfV;;OAEG;SACE,KAAK,CAAC,WAAW;IACtB;;OAEG;WACI,SAAS;IAChB;;;OAGG;gBACS,OAAO;4EAyBnB,CAAC;AAEH,eAAe,MAAM,CAAC"}
@@ -0,0 +1,11 @@
1
+ /**
2
+ * This file holds repository-wide constants that are reusable by more than 1 component.
3
+ */
4
+ /**
5
+ * A delay [ms] after which it's OK to update a live region content,
6
+ * taking under consideration delayed programmatic refocusing
7
+ * of triggering components (e.g., SelectInput) and Accessibility
8
+ * Tree updates that prevent the screen reader announcements.
9
+ */
10
+ export declare const WDS_LIVE_REGION_DELAY_MS = 175;
11
+ //# sourceMappingURL=constants.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"constants.d.ts","sourceRoot":"","sources":["../../../src/common/constants.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH;;;;;GAKG;AACH,eAAO,MAAM,wBAAwB,MAAM,CAAC"}
@@ -14,6 +14,7 @@ export * from "./locale";
14
14
  export * from "./commonProps";
15
15
  export * from "./initials";
16
16
  export * from "./colors";
17
+ export * from "./constants";
17
18
  export { Breakpoint } from "./propsValues/breakpoint";
18
19
  export { Type } from "./propsValues/type";
19
20
  export { DateMode } from "./propsValues/dateMode";
@@ -23,5 +24,6 @@ export { Sentiment } from "./propsValues/sentiment";
23
24
  export { Variant } from "./propsValues/variant";
24
25
  export { MarkdownNodeType } from "./propsValues/markdownNodeType";
25
26
  export { FileType } from "./fileType";
27
+ export { CloseButton } from "./closeButton";
26
28
  export { addNoScrollClass, removeNoScrollClass } from "./DOMOperations";
27
29
  //# sourceMappingURL=index.d.ts.map
@@ -1,11 +1,7 @@
1
1
  import { SizeSmall, SizeMedium, SizeLarge, Sentiment } from '../common';
2
- /**
3
- * @deprecated use `16 | 24 | 32 | 40 | 48 | 56 | 72` component instead
4
- */
5
- type LegacySizes = SizeSmall | SizeMedium | SizeLarge;
6
2
  export type StatusIconProps = {
7
- sentiment?: `${Sentiment}`;
8
- size?: LegacySizes | 16 | 24 | 32 | 40 | 48 | 56 | 72;
3
+ sentiment: `${Sentiment}`;
4
+ size: SizeSmall | SizeMedium | SizeLarge;
9
5
  };
10
6
  declare const StatusIcon: ({ sentiment, size: sizeProp }: StatusIconProps) => import("react").JSX.Element;
11
7
  export default StatusIcon;
@@ -1 +1 @@
1
- {"version":3,"file":"StatusIcon.d.ts","sourceRoot":"","sources":["../../../src/statusIcon/StatusIcon.tsx"],"names":[],"mappings":"AAGA,OAAO,EAAE,SAAS,EAAE,UAAU,EAAE,SAAS,EAAE,SAAS,EAAoB,MAAM,WAAW,CAAC;AAI1F;;GAEG;AACH,KAAK,WAAW,GAAG,SAAS,GAAG,UAAU,GAAG,SAAS,CAAC;AAEtD,MAAM,MAAM,eAAe,GAAG;IAC5B,SAAS,CAAC,EAAE,GAAG,SAAS,EAAE,CAAC;IAC3B,IAAI,CAAC,EAAE,WAAW,GAAG,EAAE,GAAG,EAAE,GAAG,EAAE,GAAG,EAAE,GAAG,EAAE,GAAG,EAAE,GAAG,EAAE,CAAC;CACvD,CAAC;AAmBF,QAAA,MAAM,UAAU,kCAAoD,eAAe,gCAelF,CAAC;AAEF,eAAe,UAAU,CAAC"}
1
+ {"version":3,"file":"StatusIcon.d.ts","sourceRoot":"","sources":["../../../src/statusIcon/StatusIcon.tsx"],"names":[],"mappings":"AAGA,OAAO,EAAE,SAAS,EAAE,UAAU,EAAE,SAAS,EAAE,SAAS,EAAoB,MAAM,WAAW,CAAC;AAI1F,MAAM,MAAM,eAAe,GAAG;IAC5B,SAAS,EAAE,GAAG,SAAS,EAAE,CAAC;IAC1B,IAAI,EAAE,SAAS,GAAG,UAAU,GAAG,SAAS,CAAC;CAC1C,CAAC;AAmBF,QAAA,MAAM,UAAU,kCAAsD,eAAe,gCAepF,CAAC;AAEF,eAAe,UAAU,CAAC"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@transferwise/components",
3
- "version": "0.0.0-experimental-1a9f157",
3
+ "version": "0.0.0-experimental-2975c15",
4
4
  "description": "Neptune React components",
5
5
  "license": "Apache-2.0",
6
6
  "repository": {
@@ -92,8 +92,8 @@
92
92
  "rollup-preserve-directives": "^1.1.1",
93
93
  "storybook": "^8.2.2",
94
94
  "@transferwise/less-config": "3.1.0",
95
- "@wise/components-theming": "1.6.1",
96
- "@transferwise/neptune-css": "14.19.1"
95
+ "@transferwise/neptune-css": "14.19.1",
96
+ "@wise/components-theming": "1.6.1"
97
97
  },
98
98
  "peerDependencies": {
99
99
  "@transferwise/icons": "^3.13.1",
@@ -0,0 +1,87 @@
1
+ import { useState } from 'react';
2
+ import { userEvent, within, expect, waitFor } from '@storybook/test';
3
+ import { Button, Field, SelectInput, Sentiment } from '..';
4
+ import Alert from './Alert';
5
+
6
+ import { Meta, StoryObj } from '@storybook/react';
7
+
8
+ const meta = {
9
+ title: 'Feedback/Alert/tests',
10
+ component: Alert,
11
+ argTypes: {},
12
+ args: {
13
+ type: Sentiment.POSITIVE,
14
+ active: true,
15
+ message: 'Payments sent to your bank details today might not arrive in time for the holidays.',
16
+ },
17
+ } satisfies Meta<typeof Alert>;
18
+ export default meta;
19
+
20
+ type Story = StoryObj<typeof meta>;
21
+
22
+ const wait = async (duration = 500) =>
23
+ new Promise<void>((resolve) => {
24
+ setTimeout(resolve, duration);
25
+ });
26
+
27
+ export const SimpleTrigger: Story = {
28
+ play: async ({ args, canvasElement }) => {
29
+ const canvas = within(canvasElement);
30
+ await wait();
31
+ await userEvent.tab();
32
+ await wait();
33
+ await userEvent.keyboard('{Enter}');
34
+
35
+ await waitFor(async () => expect(canvas.getByText(args.message || '')).toBeInTheDocument());
36
+ },
37
+ render: function Render(args) {
38
+ const [isActive, setIsActive] = useState(false);
39
+
40
+ return (
41
+ <>
42
+ <Button htmlType="button" onClick={() => setIsActive(true)}>
43
+ Trigger Alert
44
+ </Button>
45
+
46
+ <Alert {...args} active={isActive} className="m-t-4" />
47
+ </>
48
+ );
49
+ },
50
+ };
51
+
52
+ export const ComplexTrigger: Story = {
53
+ play: async ({ args, canvasElement }) => {
54
+ const canvas = within(canvasElement);
55
+ await wait();
56
+ await userEvent.tab();
57
+ await wait();
58
+ await userEvent.keyboard('{ArrowDown}');
59
+ await wait();
60
+ await userEvent.keyboard('{ArrowDown}');
61
+ await wait();
62
+ await userEvent.keyboard('{Enter}');
63
+
64
+ await waitFor(async () => expect(canvas.getByText(args.message || '')).toBeInTheDocument());
65
+ },
66
+ render: function Render(args) {
67
+ const [isActive, setIsActive] = useState(false);
68
+ const [value, setValue] = useState<string>();
69
+
70
+ return (
71
+ <>
72
+ <Field label="Select option to triger Alert">
73
+ <SelectInput
74
+ items={[
75
+ { type: 'option', value: 'one' },
76
+ { type: 'option', value: 'two' },
77
+ ]}
78
+ onChange={setValue}
79
+ onClose={() => setIsActive(Boolean(value))}
80
+ />
81
+ </Field>
82
+
83
+ <Alert {...args} active={isActive} className="m-t-2" />
84
+ </>
85
+ );
86
+ },
87
+ };
@@ -4,7 +4,7 @@ import { action } from '@storybook/addon-actions';
4
4
  import { ClockBorderless } from '@transferwise/icons';
5
5
 
6
6
  import { Sentiment } from '../common';
7
- import { Button } from '..';
7
+ import { Button, Field, SelectInput } from '..';
8
8
  import Alert, { AlertArrowPosition } from './Alert';
9
9
 
10
10
  export default {
@@ -109,23 +109,41 @@ export const WithTitle: Story = {
109
109
  * For ARIA live region to function correctly with screen readers,
110
110
  * the container with an appropriate ARIA role (in the case of this
111
111
  * component, it's `status` or `alert`) must be rendered first.
112
- * Once present in the accessibility tree, its dynamic contents
112
+ * Once present in the accessibility tree (AT), its dynamic contents
113
113
  * will be announced correctly.
114
114
  *
115
115
  * Because of that, using logical AND (&&) operator is discouraged
116
116
  * and, instead, engineers should toggle the `active` prop which
117
117
  * provides that logic internally.
118
+ *
119
+ * We're additionally adding a small delay (175ms) between toggling
120
+ * the `active` prop and actual DOM injection to compensate for some
121
+ * common triggers like e.g. `SelectInput`. Those components affect
122
+ * the AT and have programmatic focus control, which prevents the
123
+ * screen readers from announcing simultaneous changes on the page.
118
124
  */
119
125
  export const ConditionallyRendered: Story = {
120
126
  render: function Render(args) {
121
127
  const [isActive, setIsActive] = useState(false);
128
+ const [value, setValue] = useState<string>();
122
129
 
123
130
  return (
124
131
  <>
125
- <Button htmlType="button" onClick={() => setIsActive((value) => !value)}>
132
+ <Button htmlType="button" onClick={() => setIsActive((current) => !current)}>
126
133
  Trigger Alert
127
134
  </Button>
128
135
 
136
+ <Field label="Select `two` to triger Alert" className="m-t-3">
137
+ <SelectInput
138
+ items={[
139
+ { type: 'option', value: 'one' },
140
+ { type: 'option', value: 'two' },
141
+ ]}
142
+ onChange={setValue}
143
+ onClose={() => setIsActive(value === 'two')}
144
+ />
145
+ </Field>
146
+
129
147
  <Alert {...args} active={isActive} className="m-t-5" />
130
148
  </>
131
149
  );
@@ -134,18 +152,30 @@ export const ConditionallyRendered: Story = {
134
152
  docs: {
135
153
  source: {
136
154
  code: `
137
- function Render (args) {
155
+ function Render(args) {
138
156
  const [isActive, setIsActive] = useState(false);
157
+ const [value, setValue] = useState<string>();
139
158
 
140
159
  return (
141
160
  <>
142
- <Button htmlType="button" onClick={() => setIsActive(value => !value)}>
161
+ <Button htmlType="button" onClick={() => setIsActive((current) => !current)}>
143
162
  Trigger Alert
144
163
  </Button>
145
164
 
165
+ <Field label="Select 'two' to triger Alert" className="m-t-3">
166
+ <SelectInput
167
+ items={[
168
+ { type: 'option', value: 'one' },
169
+ { type: 'option', value: 'two' },
170
+ ]}
171
+ onChange={setValue}
172
+ onClose={() => setIsActive(value === 'two')}
173
+ />
174
+ </Field>
175
+
146
176
  <Alert {...args} active={isActive} className="m-t-5" />
147
177
  </>
148
- )
178
+ );
149
179
  }`,
150
180
  },
151
181
  },
@@ -2,8 +2,15 @@ import { clsx } from 'clsx';
2
2
  import { useState, useRef, useEffect } from 'react';
3
3
 
4
4
  import Body from '../body/Body';
5
- import { Sentiment, Size, Typography, Variant } from '../common';
6
- import { CloseButton } from '../common/closeButton';
5
+ import {
6
+ CloseButton,
7
+ Sentiment,
8
+ Size,
9
+ Typography,
10
+ Variant,
11
+ WDS_LIVE_REGION_DELAY_MS,
12
+ } from '../common';
13
+
7
14
  import StatusIcon from '../statusIcon';
8
15
  import Title from '../title/Title';
9
16
  import { logActionRequired } from '../utilities';
@@ -131,13 +138,22 @@ export default function Alert({
131
138
  }
132
139
  }, [resolvedType, type]);
133
140
 
134
- const [shouldFire, setShouldFire] = useState(false);
141
+ const [shouldFire, setShouldFire] = useState<boolean>();
142
+
143
+ const [shouldShow, setShouldShow] = useState<boolean>();
144
+ useEffect(() => {
145
+ if (shouldShow === undefined || !active) {
146
+ setShouldShow(active);
147
+ } else {
148
+ setTimeout(() => setShouldShow(active), WDS_LIVE_REGION_DELAY_MS);
149
+ }
150
+ }, [active, shouldShow]);
135
151
 
136
152
  const closeButtonReference = useRef<HTMLButtonElement>(null);
137
153
 
138
154
  return (
139
155
  <div role={resolvedType === Sentiment.NEGATIVE ? 'alert' : 'status'}>
140
- {active && (
156
+ {shouldShow && (
141
157
  <div
142
158
  className={clsx(
143
159
  'alert d-flex',
@@ -1,12 +1,10 @@
1
1
  import { Size } from '../common';
2
- import { render, screen, mockMatchMedia } from '../test-utils';
2
+ import { render, screen } from '../test-utils';
3
3
 
4
4
  import avatarColorTestCases from './colors/avatarColorTestCases.json';
5
5
 
6
6
  import Avatar, { AvatarType } from '.';
7
7
 
8
- mockMatchMedia();
9
-
10
8
  describe('Avatar', () => {
11
9
  it('renders a medium sized thumbnail Avatar with NO outline', () => {
12
10
  render(
@@ -68,7 +68,6 @@ const Avatar: React.FC<AvatarProps> = ({
68
68
  <Circle
69
69
  size={size}
70
70
  fixedSize
71
- iconSizing={false}
72
71
  className={clsx('tw-avatar', className, `tw-avatar--${size}`, `tw-avatar--${type}`, {
73
72
  'tw-avatar--outlined': outlined,
74
73
  'tw-avatar--branded': Boolean(backgroundColorFromSeed),
@@ -79,7 +78,6 @@ const Avatar: React.FC<AvatarProps> = ({
79
78
  <Circle
80
79
  size={size}
81
80
  fixedSize
82
- iconSizing={false}
83
81
  className="tw-avatar__content"
84
82
  style={{
85
83
  backgroundColor: backgroundColor || backgroundColorFromSeed,