@transferwise/components 0.0.0-experimental-1a9f157 → 0.0.0-experimental-3ab1d06

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 (78) hide show
  1. package/build/avatar/Avatar.js +0 -2
  2. package/build/avatar/Avatar.js.map +1 -1
  3. package/build/avatar/Avatar.mjs +0 -2
  4. package/build/avatar/Avatar.mjs.map +1 -1
  5. package/build/badge/Badge.js +0 -1
  6. package/build/badge/Badge.js.map +1 -1
  7. package/build/badge/Badge.mjs +0 -1
  8. package/build/badge/Badge.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/bottomSheet/BottomSheet.js +3 -1
  14. package/build/common/bottomSheet/BottomSheet.js.map +1 -1
  15. package/build/common/bottomSheet/BottomSheet.mjs +3 -1
  16. package/build/common/bottomSheet/BottomSheet.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/responsivePanel/ResponsivePanel.js +7 -1
  22. package/build/common/responsivePanel/ResponsivePanel.js.map +1 -1
  23. package/build/common/responsivePanel/ResponsivePanel.mjs +7 -1
  24. package/build/common/responsivePanel/ResponsivePanel.mjs.map +1 -1
  25. package/build/main.css +22 -6
  26. package/build/popover/Popover.js +6 -1
  27. package/build/popover/Popover.js.map +1 -1
  28. package/build/popover/Popover.mjs +7 -2
  29. package/build/popover/Popover.mjs.map +1 -1
  30. package/build/statusIcon/StatusIcon.js +4 -4
  31. package/build/statusIcon/StatusIcon.js.map +1 -1
  32. package/build/statusIcon/StatusIcon.mjs +4 -4
  33. package/build/statusIcon/StatusIcon.mjs.map +1 -1
  34. package/build/styles/circularButton/CircularButton.css +2 -2
  35. package/build/styles/common/circle/Circle.css +0 -4
  36. package/build/styles/main.css +22 -6
  37. package/build/styles/statusIcon/StatusIcon.css +20 -0
  38. package/build/types/avatar/Avatar.d.ts.map +1 -1
  39. package/build/types/common/bottomSheet/BottomSheet.d.ts +1 -1
  40. package/build/types/common/bottomSheet/BottomSheet.d.ts.map +1 -1
  41. package/build/types/common/circle/Circle.d.ts +1 -9
  42. package/build/types/common/circle/Circle.d.ts.map +1 -1
  43. package/build/types/common/responsivePanel/ResponsivePanel.d.ts.map +1 -1
  44. package/build/types/popover/Popover.d.ts +6 -4
  45. package/build/types/popover/Popover.d.ts.map +1 -1
  46. package/build/types/statusIcon/StatusIcon.d.ts +2 -6
  47. package/build/types/statusIcon/StatusIcon.d.ts.map +1 -1
  48. package/package.json +3 -3
  49. package/src/avatar/Avatar.spec.tsx +1 -3
  50. package/src/avatar/Avatar.tsx +0 -2
  51. package/src/avatarWrapper/__snapshots__/AvatarWrapper.spec.tsx.snap +11 -11
  52. package/src/badge/Badge.spec.tsx +1 -3
  53. package/src/badge/Badge.tsx +1 -1
  54. package/src/circularButton/CircularButton.css +2 -2
  55. package/src/circularButton/CircularButton.less +1 -1
  56. package/src/circularButton/CircularButton.tsx +1 -1
  57. package/src/circularButton/__snapshots__/CircularButton.spec.tsx.snap +20 -20
  58. package/src/common/bottomSheet/BottomSheet.tsx +4 -2
  59. package/src/common/circle/Circle.css +0 -4
  60. package/src/common/circle/Circle.less +0 -8
  61. package/src/common/circle/Circle.tsx +3 -36
  62. package/src/common/responsivePanel/ResponsivePanel.tsx +13 -3
  63. package/src/flowNavigation/__snapshots__/FlowNavigation.spec.js.snap +4 -4
  64. package/src/main.css +22 -6
  65. package/src/overlayHeader/OverlayHeader.spec.tsx +1 -3
  66. package/src/overlayHeader/__snapshots__/OverlayHeader.spec.tsx.snap +2 -2
  67. package/src/popover/Popover.spec.tsx +64 -21
  68. package/src/popover/Popover.story.tsx +54 -42
  69. package/src/popover/Popover.tsx +12 -5
  70. package/src/popover/__snapshots__/Popover.spec.tsx.snap +2 -0
  71. package/src/promoCard/PromoCard.spec.tsx +1 -3
  72. package/src/radio/Radio.rtl.spec.tsx +1 -2
  73. package/src/radio/__snapshots__/Radio.rtl.spec.tsx.snap +2 -2
  74. package/src/statusIcon/StatusIcon.css +20 -0
  75. package/src/statusIcon/StatusIcon.less +17 -0
  76. package/src/statusIcon/StatusIcon.spec.tsx +21 -3
  77. package/src/statusIcon/StatusIcon.story.tsx +8 -31
  78. package/src/statusIcon/StatusIcon.tsx +6 -11
@@ -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; --circle-icon-size: 24px;"
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: 48px; --circle-icon-size: 24px;"
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: 48px; --circle-icon-size: 24px;"
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: 48px; --circle-icon-size: 24px;"
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: 48px; --circle-icon-size: 24px;"
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: 48px; --circle-icon-size: 24px;"
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: 48px; --circle-icon-size: 24px;"
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: 48px; --circle-icon-size: 24px;"
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: 24px; --circle-icon-size: 16px;"
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: 48px; --circle-icon-size: 24px;"
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: 48px; --circle-icon-size: 24px;"
137
+ style="--circle-size: 48px;"
138
138
  >
139
139
  <span
140
140
  class="tw-icon tw-icon-person "
@@ -1,9 +1,7 @@
1
- import { render, cleanup, screen, mockMatchMedia } from '../test-utils';
1
+ import { render, cleanup, screen } from '../test-utils';
2
2
 
3
3
  import Badge from '.';
4
4
 
5
- mockMatchMedia();
6
-
7
5
  describe('Badge', () => {
8
6
  const defaultProps = {
9
7
  badge: <div />,
@@ -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]} fixedSize iconSizing={false} className="tw-badge__content">
61
+ <Circle size={mapLegacySize[size]} fixedSize className="tw-badge__content">
62
62
  {badge}
63
63
  </Circle>
64
64
  </div>
@@ -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 {
@@ -19,7 +19,7 @@
19
19
  .left(0);
20
20
 
21
21
  @media (--screen-400-zoom) {
22
- top: var(--size-12);
22
+ top: var(--size-8);
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 ? 72 : 56}
41
+ size={isTinyViewport ? 64 : 56}
42
42
  aria-label={children}
43
43
  className={classes}
44
44
  disabled={disabled}
@@ -7,8 +7,8 @@ exports[`CircularButton defaults renders a button of type accent and priority pr
7
7
  >
8
8
  <input
9
9
  aria-label="Add money"
10
- class="np-circle np-circle-icons-size 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); --circle-icon-size: 28px;"
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);"
12
12
  type="button"
13
13
  />
14
14
  <span
@@ -45,8 +45,8 @@ exports[`CircularButton priorities renders primary buttons 1`] = `
45
45
  >
46
46
  <input
47
47
  aria-label="Add money"
48
- class="np-circle np-circle-icons-size 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); --circle-icon-size: 28px;"
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);"
50
50
  type="button"
51
51
  />
52
52
  <span
@@ -83,8 +83,8 @@ exports[`CircularButton priorities renders primary buttons 2`] = `
83
83
  >
84
84
  <input
85
85
  aria-label="Add money"
86
- class="np-circle np-circle-icons-size 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); --circle-icon-size: 28px;"
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);"
88
88
  type="button"
89
89
  />
90
90
  <span
@@ -121,8 +121,8 @@ exports[`CircularButton priorities renders primary buttons 3`] = `
121
121
  >
122
122
  <input
123
123
  aria-label="Add money"
124
- class="np-circle np-circle-icons-size 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); --circle-icon-size: 28px;"
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);"
126
126
  type="button"
127
127
  />
128
128
  <span
@@ -159,8 +159,8 @@ exports[`CircularButton priorities renders secondary buttons 1`] = `
159
159
  >
160
160
  <input
161
161
  aria-label="Add money"
162
- class="np-circle np-circle-icons-size 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); --circle-icon-size: 28px;"
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);"
164
164
  type="button"
165
165
  />
166
166
  <span
@@ -197,8 +197,8 @@ exports[`CircularButton priorities renders secondary buttons 2`] = `
197
197
  >
198
198
  <input
199
199
  aria-label="Add money"
200
- class="np-circle np-circle-icons-size 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); --circle-icon-size: 28px;"
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);"
202
202
  type="button"
203
203
  />
204
204
  <span
@@ -235,8 +235,8 @@ exports[`CircularButton priorities renders secondary buttons 3`] = `
235
235
  >
236
236
  <input
237
237
  aria-label="Add money"
238
- class="np-circle np-circle-icons-size 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); --circle-icon-size: 28px;"
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);"
240
240
  type="button"
241
241
  />
242
242
  <span
@@ -273,8 +273,8 @@ exports[`CircularButton types renders accent buttons 1`] = `
273
273
  >
274
274
  <input
275
275
  aria-label="Add money"
276
- class="np-circle np-circle-icons-size 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); --circle-icon-size: 28px;"
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);"
278
278
  type="button"
279
279
  />
280
280
  <span
@@ -311,8 +311,8 @@ exports[`CircularButton types renders negative buttons 1`] = `
311
311
  >
312
312
  <input
313
313
  aria-label="Add money"
314
- class="np-circle np-circle-icons-size 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); --circle-icon-size: 28px;"
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);"
316
316
  type="button"
317
317
  />
318
318
  <span
@@ -349,8 +349,8 @@ exports[`CircularButton types renders positive buttons 1`] = `
349
349
  >
350
350
  <input
351
351
  aria-label="Add money"
352
- class="np-circle np-circle-icons-size 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); --circle-icon-size: 28px;"
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);"
354
354
  type="button"
355
355
  />
356
356
  <span
@@ -32,7 +32,7 @@ export type BottomSheetProps = PropsWithChildren<
32
32
  onClose?: (event: Event | SyntheticEvent) => void;
33
33
  open: boolean;
34
34
  } & CommonProps &
35
- Pick<HTMLAttributes<HTMLDivElement>, 'role' | 'aria-labelledby'>
35
+ Pick<HTMLAttributes<HTMLDivElement>, 'role' | 'aria-labelledby' | 'aria-label'>
36
36
  >;
37
37
 
38
38
  /**
@@ -185,6 +185,7 @@ const BottomSheet = ({ role = 'dialog', ...props }: BottomSheetProps) => {
185
185
  return is400Zoom ? (
186
186
  <Drawer
187
187
  aria-labelledby={props['aria-labelledby']}
188
+ aria-label={props['aria-label']}
188
189
  role={role}
189
190
  open={props.open}
190
191
  className={props.className}
@@ -203,7 +204,8 @@ const BottomSheet = ({ role = 'dialog', ...props }: BottomSheetProps) => {
203
204
  {/* eslint-disable-next-line jsx-a11y/no-noninteractive-element-interactions */}
204
205
  <div
205
206
  id={overlayId}
206
- aria-labelledby={props['aria-labelledby']}
207
+ aria-labelledby={props['aria-labelledby'] || undefined}
208
+ aria-label={props['aria-label'] || undefined}
207
209
  role={role}
208
210
  aria-modal
209
211
  onTouchStart={onSwipeStart}
@@ -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
- }
@@ -3,12 +3,4 @@
3
3
  width: var(--circle-size);
4
4
  height: var(--circle-size);
5
5
  flex-shrink: 0;
6
-
7
- &-icons-size {
8
- // circle like components has custom icon sizes
9
- .tw-icon > svg {
10
- height: var(--circle-icon-size);
11
- width: var(--circle-icon-size);
12
- }
13
- }
14
6
  }
@@ -1,9 +1,7 @@
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';
5
3
 
6
- export type ShapeSize = 16 | 24 | 32 | 40 | 48 | 56 | 72;
4
+ export type ShapeSize = 16 | 24 | 32 | 40 | 48 | 56 | 64 | 72;
7
5
 
8
6
  export type Props = {
9
7
  /**
@@ -19,57 +17,26 @@ export type Props = {
19
17
  * as those can be dynamic a at certain viewport sizes
20
18
  */
21
19
  fixedSize?: boolean;
22
- /**
23
- * This property is temporary, as some components (e.g legacy Avatar) doesn't need new icon sizing, we delete it at some point
24
- */
25
- iconSizing?: boolean;
26
20
  } & HTMLAttributes<HTMLDivElement>;
27
21
 
28
- /**
29
- * circle like components has custom sizes for icons
30
- */
31
- const MAP_ICON_SIZE = {
32
- 16: 12,
33
- 24: 16,
34
- 32: 18,
35
- 40: 20,
36
- 48: 24,
37
- 56: 28,
38
- 72: 36,
39
- };
40
-
41
22
  const Circle = forwardRef(function Circle(
42
23
  {
43
24
  as: Element = 'div',
44
25
  children,
45
26
  size = 48,
46
27
  fixedSize = false,
47
- iconSizing = true,
48
28
  className,
49
29
  style,
50
30
  ...props
51
31
  }: Props,
52
32
  ref,
53
33
  ) {
54
- const isTinyViewport = useMedia(`(max-width: ${Breakpoint.ZOOM_400}px)`);
55
34
  return (
56
35
  <Element
57
36
  {...props}
58
37
  ref={ref}
59
- style={{
60
- '--circle-size': fixedSize ? `${size}px` : `var(--size-${size})`,
61
- '--circle-icon-size':
62
- isTinyViewport && !fixedSize
63
- ? `${MAP_ICON_SIZE[size] / 2}px`
64
- : `${MAP_ICON_SIZE[size]}px`,
65
- ...style,
66
- }}
67
- className={clsx(
68
- 'np-circle',
69
- { 'np-circle-icons-size': iconSizing },
70
- 'd-flex align-items-center justify-content-center',
71
- className,
72
- )}
38
+ style={{ ...style, '--circle-size': fixedSize ? `${size}px` : `var(--size-${size})` }}
39
+ className={clsx('np-circle', 'd-flex align-items-center justify-content-center', className)}
73
40
  >
74
41
  {children}
75
42
  </Element>
@@ -3,8 +3,7 @@ import { forwardRef } from 'react';
3
3
  import { Position } from '..';
4
4
  import BottomSheet from '../bottomSheet';
5
5
  import { useLayout } from '../hooks';
6
- import Panel from '../panel';
7
- import { PanelProps } from '../panel/Panel';
6
+ import Panel, { type PanelProps } from '../panel';
8
7
 
9
8
  const ResponsivePanel = forwardRef<HTMLDivElement, PanelProps>(function ResponsivePanel(
10
9
  {
@@ -17,13 +16,22 @@ const ResponsivePanel = forwardRef<HTMLDivElement, PanelProps>(function Responsi
17
16
  open = false,
18
17
  position = Position.BOTTOM,
19
18
  anchorWidth = false,
19
+ 'aria-label': ariaLabel,
20
+ 'aria-labelledby': ariaLabelledBy,
20
21
  }: PanelProps,
21
22
  reference,
22
23
  ) {
23
24
  const { isMobile } = useLayout();
24
25
  if (isMobile) {
25
26
  return (
26
- <BottomSheet key="bottomSheet" open={open} className={className} onClose={onClose}>
27
+ <BottomSheet
28
+ key="bottomSheet"
29
+ aria-label={ariaLabel}
30
+ aria-labelledby={ariaLabelledBy}
31
+ open={open}
32
+ className={className}
33
+ onClose={onClose}
34
+ >
27
35
  {children}
28
36
  </BottomSheet>
29
37
  );
@@ -38,6 +46,8 @@ const ResponsivePanel = forwardRef<HTMLDivElement, PanelProps>(function Responsi
38
46
  position={position}
39
47
  anchorWidth={anchorWidth}
40
48
  anchorRef={anchorRef}
49
+ aria-label={ariaLabel}
50
+ aria-labelledby={ariaLabelledBy}
41
51
  className={className}
42
52
  onClose={onClose}
43
53
  >
@@ -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: 48px; --circle-icon-size: 24px;"
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: 48px; --circle-icon-size: 24px;"
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: 48px; --circle-icon-size: 24px;"
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: 48px; --circle-icon-size: 24px;"
146
+ style="--circle-size: 48px;"
147
147
  >
148
148
  TM
149
149
  </div>
package/src/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);
@@ -1,11 +1,9 @@
1
1
  import Avatar, { AvatarType } from '../avatar';
2
2
  import { Size } from '../common';
3
- import { render, mockMatchMedia } from '../test-utils';
3
+ import { render } from '../test-utils';
4
4
 
5
5
  import OverlayHeader from '.';
6
6
 
7
- mockMatchMedia();
8
-
9
7
  describe('OverlayHeader', () => {
10
8
  const props = {
11
9
  avatar: (
@@ -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: 48px; --circle-icon-size: 24px;"
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: 48px; --circle-icon-size: 24px;"
26
+ style="--circle-size: 48px;"
27
27
  >
28
28
  TM
29
29
  </div>
@@ -35,27 +35,70 @@ describe('Popover', () => {
35
35
  expect(getPanel()).toMatchSnapshot();
36
36
  });
37
37
 
38
- it('renders title', async () => {
39
- ({ container, rerender } = render(
40
- <Popover {...props}>
41
- <button type="button">Open</button>
42
- </Popover>,
43
- ));
44
-
45
- await userEvent.click(screen.getByText('Open'));
46
- await waitForPanel();
47
-
48
- expect(getTitle()).toBeInTheDocument();
49
-
50
- rerender(
51
- <Popover {...props} title={undefined}>
52
- <button type="button">Open</button>
53
- </Popover>,
54
- );
55
-
56
- await userEvent.click(screen.getByText('Open'));
57
-
58
- expect(getTitle()).not.toBeInTheDocument();
38
+ describe('title', () => {
39
+ it('renders title', async () => {
40
+ ({ container, rerender } = render(
41
+ <Popover {...props}>
42
+ <button type="button">Open</button>
43
+ </Popover>,
44
+ ));
45
+
46
+ await userEvent.click(screen.getByText('Open'));
47
+ await waitForPanel();
48
+
49
+ expect(getTitle()).toBeInTheDocument();
50
+
51
+ rerender(
52
+ <Popover {...props} title={undefined}>
53
+ <button type="button">Open</button>
54
+ </Popover>,
55
+ );
56
+
57
+ await userEvent.click(screen.getByText('Open'));
58
+
59
+ expect(getTitle()).not.toBeInTheDocument();
60
+ });
61
+
62
+ it('should uses `title` as the accessible name', async () => {
63
+ render(
64
+ <Popover {...props}>
65
+ <button type="button">Open</button>
66
+ </Popover>,
67
+ );
68
+
69
+ await userEvent.click(screen.getByText('Open'));
70
+ await waitForPanel();
71
+ });
72
+
73
+ describe('accessible name', () => {
74
+ const ACCESSIBLE_NAME = 'Accessible name';
75
+
76
+ it('should use `aria-label` as the accessible name', async () => {
77
+ render(
78
+ <Popover {...props} title={undefined} aria-label={ACCESSIBLE_NAME}>
79
+ <button type="button">Open</button>
80
+ </Popover>,
81
+ );
82
+
83
+ await userEvent.click(screen.getByText('Open'));
84
+ await waitForPanel();
85
+
86
+ expect(screen.getByRole('dialog', { name: ACCESSIBLE_NAME })).toBeInTheDocument();
87
+ });
88
+
89
+ it('should prioritise `aria-label` over `title` as the accessible name', async () => {
90
+ render(
91
+ <Popover {...props} aria-label={ACCESSIBLE_NAME}>
92
+ <button type="button">Open</button>
93
+ </Popover>,
94
+ );
95
+
96
+ await userEvent.click(screen.getByText('Open'));
97
+ await waitForPanel();
98
+
99
+ expect(screen.getByRole('dialog', { name: ACCESSIBLE_NAME })).toBeInTheDocument();
100
+ });
101
+ });
59
102
  });
60
103
 
61
104
  it('renders Panel onClick', async () => {