@transferwise/components 0.0.0-experimental-daa78e3 → 0.0.0-experimental-c76c3bc

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 (65) hide show
  1. package/build/alert/Alert.js +2 -11
  2. package/build/alert/Alert.js.map +1 -1
  3. package/build/alert/Alert.mjs +2 -11
  4. package/build/alert/Alert.mjs.map +1 -1
  5. package/build/avatar/Avatar.js +5 -0
  6. package/build/avatar/Avatar.js.map +1 -1
  7. package/build/avatar/Avatar.mjs +5 -0
  8. package/build/avatar/Avatar.mjs.map +1 -1
  9. package/build/circularButton/CircularButton.js +1 -1
  10. package/build/circularButton/CircularButton.js.map +1 -1
  11. package/build/circularButton/CircularButton.mjs +1 -1
  12. package/build/circularButton/CircularButton.mjs.map +1 -1
  13. package/build/common/circle/Circle.js +15 -2
  14. package/build/common/circle/Circle.js.map +1 -1
  15. package/build/common/circle/Circle.mjs +15 -2
  16. package/build/common/circle/Circle.mjs.map +1 -1
  17. package/build/main.css +6 -22
  18. package/build/statusIcon/StatusIcon.js +4 -4
  19. package/build/statusIcon/StatusIcon.js.map +1 -1
  20. package/build/statusIcon/StatusIcon.mjs +4 -4
  21. package/build/statusIcon/StatusIcon.mjs.map +1 -1
  22. package/build/styles/circularButton/CircularButton.css +2 -2
  23. package/build/styles/common/circle/Circle.css +4 -0
  24. package/build/styles/main.css +6 -22
  25. package/build/styles/statusIcon/StatusIcon.css +0 -20
  26. package/build/types/alert/Alert.d.ts.map +1 -1
  27. package/build/types/avatar/Avatar.d.ts.map +1 -1
  28. package/build/types/common/circle/Circle.d.ts +1 -1
  29. package/build/types/common/circle/Circle.d.ts.map +1 -1
  30. package/build/types/statusIcon/StatusIcon.d.ts +6 -2
  31. package/build/types/statusIcon/StatusIcon.d.ts.map +1 -1
  32. package/package.json +3 -3
  33. package/src/alert/Alert.story.tsx +6 -36
  34. package/src/alert/Alert.tsx +2 -12
  35. package/src/avatar/Avatar.spec.tsx +3 -1
  36. package/src/avatar/Avatar.tsx +5 -2
  37. package/src/avatarWrapper/__snapshots__/AvatarWrapper.spec.tsx.snap +11 -11
  38. package/src/badge/Badge.spec.tsx +3 -1
  39. package/src/circularButton/CircularButton.css +2 -2
  40. package/src/circularButton/CircularButton.less +1 -1
  41. package/src/circularButton/CircularButton.tsx +1 -1
  42. package/src/circularButton/__snapshots__/CircularButton.spec.tsx.snap +10 -10
  43. package/src/common/circle/Circle.css +4 -0
  44. package/src/common/circle/Circle.less +6 -0
  45. package/src/common/circle/Circle.tsx +25 -2
  46. package/src/flowNavigation/__snapshots__/FlowNavigation.spec.js.snap +4 -4
  47. package/src/main.css +6 -22
  48. package/src/overlayHeader/OverlayHeader.spec.tsx +3 -1
  49. package/src/overlayHeader/__snapshots__/OverlayHeader.spec.tsx.snap +2 -2
  50. package/src/promoCard/PromoCard.spec.tsx +3 -1
  51. package/src/radio/Radio.rtl.spec.tsx +2 -1
  52. package/src/radio/__snapshots__/Radio.rtl.spec.tsx.snap +2 -2
  53. package/src/statusIcon/StatusIcon.css +0 -20
  54. package/src/statusIcon/StatusIcon.less +0 -17
  55. package/src/statusIcon/StatusIcon.spec.tsx +3 -21
  56. package/src/statusIcon/StatusIcon.story.tsx +31 -8
  57. package/src/statusIcon/StatusIcon.tsx +12 -6
  58. package/build/constants.js +0 -15
  59. package/build/constants.js.map +0 -1
  60. package/build/constants.mjs +0 -13
  61. package/build/constants.mjs.map +0 -1
  62. package/build/types/constants.d.ts +0 -11
  63. package/build/types/constants.d.ts.map +0 -1
  64. package/src/alert/Alert.spec.story.tsx +0 -87
  65. package/src/constants.ts +0 -11
@@ -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\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,KA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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: CircleProps['size'] =\n typeof sizeProp === 'string' ? 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","_j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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;;;;"}
@@ -23,8 +23,8 @@
23
23
  }
24
24
  @media (max-width: 320px) {
25
25
  .np-circular-btn .tw-icon {
26
- top: 8px;
27
- top: var(--size-8);
26
+ top: 12px;
27
+ top: var(--size-12);
28
28
  }
29
29
  }
30
30
  .np-circular-btn .tw-icon > svg {
@@ -5,3 +5,7 @@
5
5
  height: var(--circle-size);
6
6
  flex-shrink: 0;
7
7
  }
8
+ .np-circle .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: 8px;
1017
- top: var(--size-8);
1016
+ top: 12px;
1017
+ top: var(--size-12);
1018
1018
  }
1019
1019
  }
1020
1020
  .np-circular-btn .tw-icon > svg {
@@ -1169,6 +1169,10 @@ div.critical-comms .critical-comms-body {
1169
1169
  height: var(--circle-size);
1170
1170
  flex-shrink: 0;
1171
1171
  }
1172
+ .np-circle .tw-icon > svg {
1173
+ height: var(--circle-icon-size);
1174
+ width: var(--circle-icon-size);
1175
+ }
1172
1176
  .np-bottom-sheet {
1173
1177
  border-radius: 10px 10px 0 0;
1174
1178
  }
@@ -4155,12 +4159,6 @@ html:not([dir="rtl"]) .np-navigation-option {
4155
4159
  transform: translateY(-24px);
4156
4160
  }
4157
4161
  }
4158
- .status-icon > svg {
4159
- height: 32px;
4160
- height: var(--size-32);
4161
- width: 32px;
4162
- width: var(--size-32);
4163
- }
4164
4162
  .status-circle .light {
4165
4163
  color: var(--color-contrast);
4166
4164
  }
@@ -4176,20 +4174,6 @@ html:not([dir="rtl"]) .np-navigation-option {
4176
4174
  .np-theme-personal .status-circle.pending .status-icon {
4177
4175
  color: var(--color-dark);
4178
4176
  }
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
- }
4193
4177
  .status-circle.negative,
4194
4178
  .status-circle.error {
4195
4179
  background-color: var(--color-sentiment-negative);
@@ -1,9 +1,3 @@
1
- .status-icon > svg {
2
- height: 32px;
3
- height: var(--size-32);
4
- width: 32px;
5
- width: var(--size-32);
6
- }
7
1
  .status-circle .light {
8
2
  color: var(--color-contrast);
9
3
  }
@@ -19,20 +13,6 @@
19
13
  .np-theme-personal .status-circle.pending .status-icon {
20
14
  color: var(--color-dark);
21
15
  }
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
- }
36
16
  .status-circle.negative,
37
17
  .status-circle.error {
38
18
  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;AAUjE,MAAM,MAAM,WAAW,GAAG;IACxB,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,IAAI,E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AAC;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,5 +1,5 @@
1
1
  import { HTMLAttributes } from 'react';
2
- export type ShapeSize = 16 | 24 | 32 | 40 | 48 | 56 | 64 | 72;
2
+ export type ShapeSize = 16 | 24 | 32 | 40 | 48 | 56 | 72;
3
3
  export type Props = {
4
4
  /**
5
5
  * Modify underlying element, `div` by default
@@ -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,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"}
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;CACrB,GAAG,cAAc,CAAC,cAAc,CAAC,CAAC;AAenC,QAAA,MAAM,MAAM;IA5BV;;OAEG;SACE,KAAK,CAAC,WAAW;IACtB;;OAEG;WACI,SAAS;IAChB;;;OAGG;gBACS,OAAO;4EA8CnB,CAAC;AAEH,eAAe,MAAM,CAAC"}
@@ -1,7 +1,11 @@
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;
2
6
  export type StatusIconProps = {
3
- sentiment: `${Sentiment}`;
4
- size: SizeSmall | SizeMedium | SizeLarge;
7
+ sentiment?: `${Sentiment}`;
8
+ size?: LegacySizes | 16 | 24 | 32 | 40 | 48 | 56 | 72;
5
9
  };
6
10
  declare const StatusIcon: ({ sentiment, size: sizeProp }: StatusIconProps) => import("react").JSX.Element;
7
11
  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,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"}
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,gCAgBlF,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-daa78e3",
3
+ "version": "0.0.0-experimental-c76c3bc",
4
4
  "description": "Neptune React components",
5
5
  "license": "Apache-2.0",
6
6
  "repository": {
@@ -91,9 +91,9 @@
91
91
  "rollup": "^4.18.1",
92
92
  "rollup-preserve-directives": "^1.1.1",
93
93
  "storybook": "^8.2.2",
94
- "@transferwise/less-config": "3.1.0",
95
94
  "@transferwise/neptune-css": "14.19.1",
96
- "@wise/components-theming": "1.6.1"
95
+ "@wise/components-theming": "1.6.1",
96
+ "@transferwise/less-config": "3.1.0"
97
97
  },
98
98
  "peerDependencies": {
99
99
  "@transferwise/icons": "^3.13.1",
@@ -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, Field, SelectInput } from '..';
7
+ import { Button } from '..';
8
8
  import Alert, { AlertArrowPosition } from './Alert';
9
9
 
10
10
  export default {
@@ -109,41 +109,23 @@ 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 (AT), its dynamic contents
112
+ * Once present in the accessibility tree, 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.
124
118
  */
125
119
  export const ConditionallyRendered: Story = {
126
120
  render: function Render(args) {
127
121
  const [isActive, setIsActive] = useState(false);
128
- const [value, setValue] = useState<string>();
129
122
 
130
123
  return (
131
124
  <>
132
- <Button htmlType="button" onClick={() => setIsActive((current) => !current)}>
125
+ <Button htmlType="button" onClick={() => setIsActive((value) => !value)}>
133
126
  Trigger Alert
134
127
  </Button>
135
128
 
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
-
147
129
  <Alert {...args} active={isActive} className="m-t-5" />
148
130
  </>
149
131
  );
@@ -152,30 +134,18 @@ export const ConditionallyRendered: Story = {
152
134
  docs: {
153
135
  source: {
154
136
  code: `
155
- function Render(args) {
137
+ function Render (args) {
156
138
  const [isActive, setIsActive] = useState(false);
157
- const [value, setValue] = useState<string>();
158
139
 
159
140
  return (
160
141
  <>
161
- <Button htmlType="button" onClick={() => setIsActive((current) => !current)}>
142
+ <Button htmlType="button" onClick={() => setIsActive(value => !value)}>
162
143
  Trigger Alert
163
144
  </Button>
164
145
 
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
-
176
146
  <Alert {...args} active={isActive} className="m-t-5" />
177
147
  </>
178
- );
148
+ )
179
149
  }`,
180
150
  },
181
151
  },
@@ -7,7 +7,6 @@ import { CloseButton } from '../common/closeButton';
7
7
  import StatusIcon from '../statusIcon';
8
8
  import Title from '../title/Title';
9
9
  import { logActionRequired } from '../utilities';
10
- import { WDS_LIVE_REGION_DELAY_MS } from '../constants';
11
10
 
12
11
  import InlineMarkdown from './inlineMarkdown';
13
12
  import { Action } from '../common/action/Action';
@@ -132,22 +131,13 @@ export default function Alert({
132
131
  }
133
132
  }, [resolvedType, type]);
134
133
 
135
- const [shouldFire, setShouldFire] = useState<boolean>();
136
-
137
- const [shouldShow, setShouldShow] = useState<boolean>();
138
- useEffect(() => {
139
- if (shouldShow === undefined || !active) {
140
- setShouldShow(active);
141
- } else {
142
- setTimeout(() => setShouldShow(active), WDS_LIVE_REGION_DELAY_MS);
143
- }
144
- }, [active, shouldShow]);
134
+ const [shouldFire, setShouldFire] = useState(false);
145
135
 
146
136
  const closeButtonReference = useRef<HTMLButtonElement>(null);
147
137
 
148
138
  return (
149
139
  <div role={resolvedType === Sentiment.NEGATIVE ? 'alert' : 'status'}>
150
- {shouldShow && (
140
+ {active && (
151
141
  <div
152
142
  className={clsx(
153
143
  'alert d-flex',
@@ -1,10 +1,12 @@
1
1
  import { Size } from '../common';
2
- import { render, screen } from '../test-utils';
2
+ import { render, screen, mockMatchMedia } 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
+
8
10
  describe('Avatar', () => {
9
11
  it('renders a medium sized thumbnail Avatar with NO outline', () => {
10
12
  render(
@@ -1,9 +1,10 @@
1
1
  import { clsx } from 'clsx';
2
2
  import { useMemo } from 'react';
3
3
 
4
- import { getBrandColorFromSeed, Theme } from '../common';
4
+ import { Breakpoint, getBrandColorFromSeed, Theme } from '../common';
5
5
 
6
6
  import Circle from '../common/circle';
7
+ import { useMedia } from '../common/hooks/useMedia';
7
8
 
8
9
  type NumericAvatarSize = 24 | 40 | 48 | 56 | 72;
9
10
 
@@ -63,7 +64,7 @@ const Avatar: React.FC<AvatarProps> = ({
63
64
  );
64
65
 
65
66
  const size = backwardsCompatibleSize(sizeFromProps);
66
-
67
+ const isTinyViewport = useMedia(`(max-width: ${Breakpoint.ZOOM_400}px)`);
67
68
  return (
68
69
  <Circle
69
70
  size={size}
@@ -80,6 +81,8 @@ const Avatar: React.FC<AvatarProps> = ({
80
81
  fixedSize
81
82
  className="tw-avatar__content"
82
83
  style={{
84
+ // @ts-expect-error CSS custom props allowed
85
+ '--circle-icon-size': '16px',
83
86
  backgroundColor: backgroundColor || backgroundColorFromSeed,
84
87
  }}
85
88
  >
@@ -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: 48px;"
6
+ style="--circle-size: 48px; --circle-icon-size: 24px;"
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: 48px;"
10
+ style="--circle-size: 48px; --circle-icon-size: 16px;"
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: 48px;"
23
+ style="--circle-size: 48px; --circle-icon-size: 24px;"
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: 48px;"
27
+ style="--circle-size: 48px; --circle-icon-size: 16px;"
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: 48px;"
54
+ style="--circle-size: 48px; --circle-icon-size: 24px;"
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: 48px;"
58
+ style="--circle-size: 48px; --circle-icon-size: 16px;"
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: 48px;"
91
+ style="--circle-size: 48px; --circle-icon-size: 24px;"
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: 48px;"
95
+ style="--circle-size: 48px; --circle-icon-size: 16px;"
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: 24px;"
120
+ style="--circle-size: 24px; --circle-icon-size: 16px;"
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: 48px;"
133
+ style="--circle-size: 48px; --circle-icon-size: 24px;"
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: 48px;"
137
+ style="--circle-size: 48px; --circle-icon-size: 16px;"
138
138
  >
139
139
  <span
140
140
  class="tw-icon tw-icon-person "
@@ -1,7 +1,9 @@
1
- import { render, cleanup, screen } from '../test-utils';
1
+ import { render, cleanup, screen, mockMatchMedia } from '../test-utils';
2
2
 
3
3
  import Badge from '.';
4
4
 
5
+ mockMatchMedia();
6
+
5
7
  describe('Badge', () => {
6
8
  const defaultProps = {
7
9
  badge: <div />,
@@ -23,8 +23,8 @@
23
23
  }
24
24
  @media (max-width: 320px) {
25
25
  .np-circular-btn .tw-icon {
26
- top: 8px;
27
- top: var(--size-8);
26
+ top: 12px;
27
+ top: var(--size-12);
28
28
  }
29
29
  }
30
30
  .np-circular-btn .tw-icon > svg {
@@ -19,7 +19,7 @@
19
19
  .left(0);
20
20
 
21
21
  @media (--screen-400-zoom) {
22
- top: var(--size-8);
22
+ top: var(--size-12);
23
23
  }
24
24
 
25
25
  > svg {
@@ -38,7 +38,7 @@ const CircularButton = ({
38
38
  as="input"
39
39
  // @ts-expect-error it's input[type=button] element
40
40
  type="button"
41
- size={isTinyViewport ? 64 : 56}
41
+ size={isTinyViewport ? 72 : 56}
42
42
  aria-label={children}
43
43
  className={classes}
44
44
  disabled={disabled}
@@ -8,7 +8,7 @@ exports[`CircularButton defaults renders a button of type accent and priority pr
8
8
  <input
9
9
  aria-label="Add money"
10
10
  class="np-circle d-flex align-items-center justify-content-center btn np-btn m-b-1 btn-accent btn-priority-1"
11
- style="--circle-size: var(--size-56);"
11
+ style="--circle-size: var(--size-56); --circle-icon-size: 28px;"
12
12
  type="button"
13
13
  />
14
14
  <span
@@ -46,7 +46,7 @@ exports[`CircularButton priorities renders primary buttons 1`] = `
46
46
  <input
47
47
  aria-label="Add money"
48
48
  class="np-circle d-flex align-items-center justify-content-center btn np-btn m-b-1 btn-accent btn-priority-1"
49
- style="--circle-size: var(--size-56);"
49
+ style="--circle-size: var(--size-56); --circle-icon-size: 28px;"
50
50
  type="button"
51
51
  />
52
52
  <span
@@ -84,7 +84,7 @@ exports[`CircularButton priorities renders primary buttons 2`] = `
84
84
  <input
85
85
  aria-label="Add money"
86
86
  class="np-circle d-flex align-items-center justify-content-center btn np-btn m-b-1 btn-positive btn-priority-1"
87
- style="--circle-size: var(--size-56);"
87
+ style="--circle-size: var(--size-56); --circle-icon-size: 28px;"
88
88
  type="button"
89
89
  />
90
90
  <span
@@ -122,7 +122,7 @@ exports[`CircularButton priorities renders primary buttons 3`] = `
122
122
  <input
123
123
  aria-label="Add money"
124
124
  class="np-circle d-flex align-items-center justify-content-center btn np-btn m-b-1 btn-negative btn-priority-1"
125
- style="--circle-size: var(--size-56);"
125
+ style="--circle-size: var(--size-56); --circle-icon-size: 28px;"
126
126
  type="button"
127
127
  />
128
128
  <span
@@ -160,7 +160,7 @@ exports[`CircularButton priorities renders secondary buttons 1`] = `
160
160
  <input
161
161
  aria-label="Add money"
162
162
  class="np-circle d-flex align-items-center justify-content-center btn np-btn m-b-1 btn-accent btn-priority-2"
163
- style="--circle-size: var(--size-56);"
163
+ style="--circle-size: var(--size-56); --circle-icon-size: 28px;"
164
164
  type="button"
165
165
  />
166
166
  <span
@@ -198,7 +198,7 @@ exports[`CircularButton priorities renders secondary buttons 2`] = `
198
198
  <input
199
199
  aria-label="Add money"
200
200
  class="np-circle d-flex align-items-center justify-content-center btn np-btn m-b-1 btn-positive btn-priority-2"
201
- style="--circle-size: var(--size-56);"
201
+ style="--circle-size: var(--size-56); --circle-icon-size: 28px;"
202
202
  type="button"
203
203
  />
204
204
  <span
@@ -236,7 +236,7 @@ exports[`CircularButton priorities renders secondary buttons 3`] = `
236
236
  <input
237
237
  aria-label="Add money"
238
238
  class="np-circle d-flex align-items-center justify-content-center btn np-btn m-b-1 btn-negative btn-priority-2"
239
- style="--circle-size: var(--size-56);"
239
+ style="--circle-size: var(--size-56); --circle-icon-size: 28px;"
240
240
  type="button"
241
241
  />
242
242
  <span
@@ -274,7 +274,7 @@ exports[`CircularButton types renders accent buttons 1`] = `
274
274
  <input
275
275
  aria-label="Add money"
276
276
  class="np-circle d-flex align-items-center justify-content-center btn np-btn m-b-1 btn-accent btn-priority-1"
277
- style="--circle-size: var(--size-56);"
277
+ style="--circle-size: var(--size-56); --circle-icon-size: 28px;"
278
278
  type="button"
279
279
  />
280
280
  <span
@@ -312,7 +312,7 @@ exports[`CircularButton types renders negative buttons 1`] = `
312
312
  <input
313
313
  aria-label="Add money"
314
314
  class="np-circle d-flex align-items-center justify-content-center btn np-btn m-b-1 btn-negative btn-priority-1"
315
- style="--circle-size: var(--size-56);"
315
+ style="--circle-size: var(--size-56); --circle-icon-size: 28px;"
316
316
  type="button"
317
317
  />
318
318
  <span
@@ -350,7 +350,7 @@ exports[`CircularButton types renders positive buttons 1`] = `
350
350
  <input
351
351
  aria-label="Add money"
352
352
  class="np-circle d-flex align-items-center justify-content-center btn np-btn m-b-1 btn-positive btn-priority-1"
353
- style="--circle-size: var(--size-56);"
353
+ style="--circle-size: var(--size-56); --circle-icon-size: 28px;"
354
354
  type="button"
355
355
  />
356
356
  <span
@@ -5,3 +5,7 @@
5
5
  height: var(--circle-size);
6
6
  flex-shrink: 0;
7
7
  }
8
+ .np-circle .tw-icon > svg {
9
+ height: var(--circle-icon-size);
10
+ width: var(--circle-icon-size);
11
+ }
@@ -3,4 +3,10 @@
3
3
  width: var(--circle-size);
4
4
  height: var(--circle-size);
5
5
  flex-shrink: 0;
6
+
7
+ // has custom icon sizes
8
+ .tw-icon > svg {
9
+ height: var(--circle-icon-size);
10
+ width: var(--circle-icon-size);
11
+ }
6
12
  }
@@ -1,7 +1,9 @@
1
1
  import { HTMLAttributes, forwardRef } from 'react';
2
2
  import { clsx } from 'clsx';
3
+ import { useMedia } from '../hooks/useMedia';
4
+ import { Breakpoint } from '../propsValues/breakpoint';
3
5
 
4
- export type ShapeSize = 16 | 24 | 32 | 40 | 48 | 56 | 64 | 72;
6
+ export type ShapeSize = 16 | 24 | 32 | 40 | 48 | 56 | 72;
5
7
 
6
8
  export type Props = {
7
9
  /**
@@ -19,6 +21,19 @@ export type Props = {
19
21
  fixedSize?: boolean;
20
22
  } & HTMLAttributes<HTMLDivElement>;
21
23
 
24
+ /**
25
+ * circle like components has custom sizes for icons
26
+ */
27
+ const MAP_ICON_SIZE = {
28
+ 16: 12,
29
+ 24: 16,
30
+ 32: 18,
31
+ 40: 20,
32
+ 48: 24,
33
+ 56: 28,
34
+ 72: 36,
35
+ };
36
+
22
37
  const Circle = forwardRef(function Circle(
23
38
  {
24
39
  as: Element = 'div',
@@ -31,11 +46,19 @@ const Circle = forwardRef(function Circle(
31
46
  }: Props,
32
47
  ref,
33
48
  ) {
49
+ const isTinyViewport = useMedia(`(max-width: ${Breakpoint.ZOOM_400}px)`);
34
50
  return (
35
51
  <Element
36
52
  {...props}
37
53
  ref={ref}
38
- style={{ ...style, '--circle-size': fixedSize ? `${size}px` : `var(--size-${size})` }}
54
+ style={{
55
+ '--circle-size': fixedSize ? `${size}px` : `var(--size-${size})`,
56
+ '--circle-icon-size':
57
+ isTinyViewport && !fixedSize
58
+ ? `${MAP_ICON_SIZE[size] / 2}px`
59
+ : `${MAP_ICON_SIZE[size]}px`,
60
+ ...style,
61
+ }}
39
62
  className={clsx('np-circle', 'd-flex align-items-center justify-content-center', className)}
40
63
  >
41
64
  {children}