@transferwise/components 0.0.0-experimental-5d1d6d8 → 0.0.0-experimental-4ff5897
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.
- package/build/avatar/Avatar.js +1 -0
- package/build/avatar/Avatar.js.map +1 -1
- package/build/avatar/Avatar.mjs +1 -0
- package/build/avatar/Avatar.mjs.map +1 -1
- package/build/badge/Badge.js +1 -0
- package/build/badge/Badge.js.map +1 -1
- package/build/badge/Badge.mjs +1 -0
- package/build/badge/Badge.mjs.map +1 -1
- package/build/circularButton/CircularButton.js +1 -1
- package/build/circularButton/CircularButton.js.map +1 -1
- package/build/circularButton/CircularButton.mjs +1 -1
- package/build/circularButton/CircularButton.mjs.map +1 -1
- package/build/common/bottomSheet/BottomSheet.js +1 -3
- package/build/common/bottomSheet/BottomSheet.js.map +1 -1
- package/build/common/bottomSheet/BottomSheet.mjs +1 -3
- package/build/common/bottomSheet/BottomSheet.mjs.map +1 -1
- package/build/common/circle/Circle.js +19 -3
- package/build/common/circle/Circle.js.map +1 -1
- package/build/common/circle/Circle.mjs +19 -3
- package/build/common/circle/Circle.mjs.map +1 -1
- package/build/common/responsivePanel/ResponsivePanel.js +1 -7
- package/build/common/responsivePanel/ResponsivePanel.js.map +1 -1
- package/build/common/responsivePanel/ResponsivePanel.mjs +1 -7
- package/build/common/responsivePanel/ResponsivePanel.mjs.map +1 -1
- package/build/main.css +6 -22
- package/build/popover/Popover.js +1 -6
- package/build/popover/Popover.js.map +1 -1
- package/build/popover/Popover.mjs +2 -7
- package/build/popover/Popover.mjs.map +1 -1
- package/build/statusIcon/StatusIcon.js +4 -4
- package/build/statusIcon/StatusIcon.js.map +1 -1
- package/build/statusIcon/StatusIcon.mjs +4 -4
- package/build/statusIcon/StatusIcon.mjs.map +1 -1
- package/build/styles/circularButton/CircularButton.css +2 -2
- package/build/styles/common/circle/Circle.css +4 -0
- package/build/styles/main.css +6 -22
- package/build/styles/statusIcon/StatusIcon.css +0 -20
- package/build/types/avatar/Avatar.d.ts.map +1 -1
- package/build/types/common/bottomSheet/BottomSheet.d.ts +1 -1
- package/build/types/common/bottomSheet/BottomSheet.d.ts.map +1 -1
- package/build/types/common/circle/Circle.d.ts +9 -1
- package/build/types/common/circle/Circle.d.ts.map +1 -1
- package/build/types/common/responsivePanel/ResponsivePanel.d.ts.map +1 -1
- package/build/types/popover/Popover.d.ts +4 -6
- package/build/types/popover/Popover.d.ts.map +1 -1
- package/build/types/statusIcon/StatusIcon.d.ts +6 -2
- package/build/types/statusIcon/StatusIcon.d.ts.map +1 -1
- package/package.json +3 -3
- package/src/avatar/Avatar.spec.tsx +3 -1
- package/src/avatar/Avatar.tsx +1 -0
- package/src/avatarWrapper/__snapshots__/AvatarWrapper.spec.tsx.snap +16 -16
- package/src/badge/Badge.spec.tsx +3 -1
- package/src/badge/Badge.tsx +1 -1
- package/src/circularButton/CircularButton.css +2 -2
- package/src/circularButton/CircularButton.less +1 -1
- package/src/circularButton/CircularButton.tsx +1 -1
- package/src/circularButton/__snapshots__/CircularButton.spec.tsx.snap +20 -20
- package/src/common/bottomSheet/BottomSheet.tsx +2 -4
- package/src/common/circle/Circle.css +4 -0
- package/src/common/circle/Circle.less +8 -0
- package/src/common/circle/Circle.tsx +36 -3
- package/src/common/responsivePanel/ResponsivePanel.tsx +3 -13
- package/src/flowNavigation/__snapshots__/FlowNavigation.spec.js.snap +6 -6
- package/src/main.css +6 -22
- package/src/overlayHeader/OverlayHeader.spec.tsx +3 -1
- package/src/overlayHeader/__snapshots__/OverlayHeader.spec.tsx.snap +3 -3
- package/src/popover/Popover.spec.tsx +21 -64
- package/src/popover/Popover.story.tsx +42 -54
- package/src/popover/Popover.tsx +5 -12
- package/src/popover/__snapshots__/Popover.spec.tsx.snap +0 -2
- package/src/promoCard/PromoCard.spec.tsx +3 -1
- package/src/radio/Radio.rtl.spec.tsx +2 -1
- package/src/radio/__snapshots__/Radio.rtl.spec.tsx.snap +3 -3
- package/src/statusIcon/StatusIcon.css +0 -20
- package/src/statusIcon/StatusIcon.less +0 -17
- package/src/statusIcon/StatusIcon.spec.tsx +3 -21
- package/src/statusIcon/StatusIcon.story.tsx +31 -8
- package/src/statusIcon/StatusIcon.tsx +12 -6
- package/build/types/constants.d.ts +0 -11
- package/build/types/constants.d.ts.map +0 -1
- package/src/constants.ts +0 -11
|
@@ -2,12 +2,12 @@
|
|
|
2
2
|
|
|
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
|
-
class="np-circle d-flex align-items-center justify-content-center tw-avatar tw-avatar--48 tw-avatar--thumbnail"
|
|
6
|
-
style="--circle-size: 48px;"
|
|
5
|
+
class="np-circle np-circle-icons-size 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;"
|
|
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: 24px;"
|
|
11
11
|
>
|
|
12
12
|
<img
|
|
13
13
|
alt=""
|
|
@@ -19,12 +19,12 @@ exports[`FlowNavigationAvatar with a name AND profileType FlowNavigationAvatar w
|
|
|
19
19
|
|
|
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
|
-
class="np-circle d-flex align-items-center justify-content-center tw-avatar tw-avatar--48 tw-avatar--icon"
|
|
23
|
-
style="--circle-size: 48px;"
|
|
22
|
+
class="np-circle np-circle-icons-size 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;"
|
|
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: 24px;"
|
|
28
28
|
>
|
|
29
29
|
<span
|
|
30
30
|
class="tw-icon tw-icon-briefcase "
|
|
@@ -50,12 +50,12 @@ exports[`FlowNavigationAvatar with a name AND profileType FlowNavigationAvatar w
|
|
|
50
50
|
|
|
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
|
-
class="np-circle d-flex align-items-center justify-content-center tw-avatar tw-avatar--48 tw-avatar--icon"
|
|
54
|
-
style="--circle-size: 48px;"
|
|
53
|
+
class="np-circle np-circle-icons-size 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;"
|
|
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: 24px;"
|
|
59
59
|
>
|
|
60
60
|
<span
|
|
61
61
|
class="tw-icon tw-icon-person "
|
|
@@ -87,12 +87,12 @@ exports[`FlowNavigationAvatar with a name AND profileType with a badge url passe
|
|
|
87
87
|
class="tw-badge__children"
|
|
88
88
|
>
|
|
89
89
|
<div
|
|
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;"
|
|
90
|
+
class="np-circle np-circle-icons-size 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;"
|
|
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: 24px;"
|
|
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"
|
|
@@ -129,12 +129,12 @@ exports[`FlowNavigationAvatar with a name AND profileType with a badge url passe
|
|
|
129
129
|
|
|
130
130
|
exports[`FlowNavigationAvatar with a name AND profileType with nothing passed renders a personal icon 1`] = `
|
|
131
131
|
<div
|
|
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;"
|
|
132
|
+
class="np-circle np-circle-icons-size 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;"
|
|
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: 24px;"
|
|
138
138
|
>
|
|
139
139
|
<span
|
|
140
140
|
class="tw-icon tw-icon-person "
|
package/src/badge/Badge.spec.tsx
CHANGED
package/src/badge/Badge.tsx
CHANGED
|
@@ -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 className="tw-badge__content">
|
|
61
|
+
<Circle size={mapLegacySize[size]} fixedSize iconSizing={false} className="tw-badge__content">
|
|
62
62
|
{badge}
|
|
63
63
|
</Circle>
|
|
64
64
|
</div>
|
|
@@ -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 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);"
|
|
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;"
|
|
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 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);"
|
|
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;"
|
|
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 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);"
|
|
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;"
|
|
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 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);"
|
|
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;"
|
|
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 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);"
|
|
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;"
|
|
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 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);"
|
|
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;"
|
|
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 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);"
|
|
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;"
|
|
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 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);"
|
|
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;"
|
|
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 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);"
|
|
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;"
|
|
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 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);"
|
|
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;"
|
|
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'>
|
|
36
36
|
>;
|
|
37
37
|
|
|
38
38
|
/**
|
|
@@ -185,7 +185,6 @@ 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']}
|
|
189
188
|
role={role}
|
|
190
189
|
open={props.open}
|
|
191
190
|
className={props.className}
|
|
@@ -204,8 +203,7 @@ const BottomSheet = ({ role = 'dialog', ...props }: BottomSheetProps) => {
|
|
|
204
203
|
{/* eslint-disable-next-line jsx-a11y/no-noninteractive-element-interactions */}
|
|
205
204
|
<div
|
|
206
205
|
id={overlayId}
|
|
207
|
-
aria-labelledby={props['aria-labelledby']
|
|
208
|
-
aria-label={props['aria-label'] || undefined}
|
|
206
|
+
aria-labelledby={props['aria-labelledby']}
|
|
209
207
|
role={role}
|
|
210
208
|
aria-modal
|
|
211
209
|
onTouchStart={onSwipeStart}
|
|
@@ -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 |
|
|
6
|
+
export type ShapeSize = 16 | 24 | 32 | 40 | 48 | 56 | 72;
|
|
5
7
|
|
|
6
8
|
export type Props = {
|
|
7
9
|
/**
|
|
@@ -17,26 +19,57 @@ export type Props = {
|
|
|
17
19
|
* as those can be dynamic a at certain viewport sizes
|
|
18
20
|
*/
|
|
19
21
|
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;
|
|
20
26
|
} & HTMLAttributes<HTMLDivElement>;
|
|
21
27
|
|
|
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
|
+
|
|
22
41
|
const Circle = forwardRef(function Circle(
|
|
23
42
|
{
|
|
24
43
|
as: Element = 'div',
|
|
25
44
|
children,
|
|
26
45
|
size = 48,
|
|
27
46
|
fixedSize = false,
|
|
47
|
+
iconSizing = true,
|
|
28
48
|
className,
|
|
29
49
|
style,
|
|
30
50
|
...props
|
|
31
51
|
}: Props,
|
|
32
52
|
ref,
|
|
33
53
|
) {
|
|
54
|
+
const isTinyViewport = useMedia(`(max-width: ${Breakpoint.ZOOM_400}px)`);
|
|
34
55
|
return (
|
|
35
56
|
<Element
|
|
36
57
|
{...props}
|
|
37
58
|
ref={ref}
|
|
38
|
-
style={{
|
|
39
|
-
|
|
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
|
+
)}
|
|
40
73
|
>
|
|
41
74
|
{children}
|
|
42
75
|
</Element>
|
|
@@ -3,7 +3,8 @@ import { forwardRef } from 'react';
|
|
|
3
3
|
import { Position } from '..';
|
|
4
4
|
import BottomSheet from '../bottomSheet';
|
|
5
5
|
import { useLayout } from '../hooks';
|
|
6
|
-
import Panel
|
|
6
|
+
import Panel from '../panel';
|
|
7
|
+
import { PanelProps } from '../panel/Panel';
|
|
7
8
|
|
|
8
9
|
const ResponsivePanel = forwardRef<HTMLDivElement, PanelProps>(function ResponsivePanel(
|
|
9
10
|
{
|
|
@@ -16,22 +17,13 @@ const ResponsivePanel = forwardRef<HTMLDivElement, PanelProps>(function Responsi
|
|
|
16
17
|
open = false,
|
|
17
18
|
position = Position.BOTTOM,
|
|
18
19
|
anchorWidth = false,
|
|
19
|
-
'aria-label': ariaLabel,
|
|
20
|
-
'aria-labelledby': ariaLabelledBy,
|
|
21
20
|
}: PanelProps,
|
|
22
21
|
reference,
|
|
23
22
|
) {
|
|
24
23
|
const { isMobile } = useLayout();
|
|
25
24
|
if (isMobile) {
|
|
26
25
|
return (
|
|
27
|
-
<BottomSheet
|
|
28
|
-
key="bottomSheet"
|
|
29
|
-
aria-label={ariaLabel}
|
|
30
|
-
aria-labelledby={ariaLabelledBy}
|
|
31
|
-
open={open}
|
|
32
|
-
className={className}
|
|
33
|
-
onClose={onClose}
|
|
34
|
-
>
|
|
26
|
+
<BottomSheet key="bottomSheet" open={open} className={className} onClose={onClose}>
|
|
35
27
|
{children}
|
|
36
28
|
</BottomSheet>
|
|
37
29
|
);
|
|
@@ -46,8 +38,6 @@ const ResponsivePanel = forwardRef<HTMLDivElement, PanelProps>(function Responsi
|
|
|
46
38
|
position={position}
|
|
47
39
|
anchorWidth={anchorWidth}
|
|
48
40
|
anchorRef={anchorRef}
|
|
49
|
-
aria-label={ariaLabel}
|
|
50
|
-
aria-labelledby={ariaLabelledBy}
|
|
51
41
|
className={className}
|
|
52
42
|
onClose={onClose}
|
|
53
43
|
>
|
|
@@ -21,12 +21,12 @@ exports[`FlowNavigation on mobile renders as expected 1`] = `
|
|
|
21
21
|
class="np-flow-header__right d-flex align-items-center justify-content-end order-2--lg"
|
|
22
22
|
>
|
|
23
23
|
<div
|
|
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;"
|
|
24
|
+
class="np-circle np-circle-icons-size 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;"
|
|
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;"
|
|
29
|
+
style="--circle-size: 48px; --circle-icon-size: 24px;"
|
|
30
30
|
>
|
|
31
31
|
TM
|
|
32
32
|
</div>
|
|
@@ -138,12 +138,12 @@ exports[`FlowNavigation renders as expected 1`] = `
|
|
|
138
138
|
class="np-flow-header__right d-flex align-items-center justify-content-end order-2--lg"
|
|
139
139
|
>
|
|
140
140
|
<div
|
|
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;"
|
|
141
|
+
class="np-circle np-circle-icons-size 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;"
|
|
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;"
|
|
146
|
+
style="--circle-size: 48px; --circle-icon-size: 24px;"
|
|
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:
|
|
1017
|
-
top: var(--size-
|
|
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-icons-size .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,11 @@
|
|
|
1
1
|
import Avatar, { AvatarType } from '../avatar';
|
|
2
2
|
import { Size } from '../common';
|
|
3
|
-
import { render } from '../test-utils';
|
|
3
|
+
import { render, mockMatchMedia } from '../test-utils';
|
|
4
4
|
|
|
5
5
|
import OverlayHeader from '.';
|
|
6
6
|
|
|
7
|
+
mockMatchMedia();
|
|
8
|
+
|
|
7
9
|
describe('OverlayHeader', () => {
|
|
8
10
|
const props = {
|
|
9
11
|
avatar: (
|
|
@@ -18,12 +18,12 @@ exports[`OverlayHeader renders as expected 1`] = `
|
|
|
18
18
|
class="d-flex align-items-center order-2"
|
|
19
19
|
>
|
|
20
20
|
<div
|
|
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;"
|
|
21
|
+
class="np-circle np-circle-icons-size 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;"
|
|
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;"
|
|
26
|
+
style="--circle-size: 48px; --circle-icon-size: 24px;"
|
|
27
27
|
>
|
|
28
28
|
TM
|
|
29
29
|
</div>
|
|
@@ -35,70 +35,27 @@ describe('Popover', () => {
|
|
|
35
35
|
expect(getPanel()).toMatchSnapshot();
|
|
36
36
|
});
|
|
37
37
|
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
<
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
<
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
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
|
-
});
|
|
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();
|
|
102
59
|
});
|
|
103
60
|
|
|
104
61
|
it('renders Panel onClick', async () => {
|