@transferwise/components 0.0.0-experimental-a9c89de → 0.0.0-experimental-b6ae643
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/common/liveRegion/LiveRegion.js +7 -46
- package/build/common/liveRegion/LiveRegion.js.map +1 -1
- package/build/common/liveRegion/LiveRegion.mjs +7 -46
- package/build/common/liveRegion/LiveRegion.mjs.map +1 -1
- package/build/flowNavigation/FlowNavigation.js +0 -1
- package/build/flowNavigation/FlowNavigation.js.map +1 -1
- package/build/flowNavigation/FlowNavigation.mjs +0 -1
- package/build/flowNavigation/FlowNavigation.mjs.map +1 -1
- package/build/main.css +69 -5
- package/build/overlayHeader/OverlayHeader.js +0 -1
- package/build/overlayHeader/OverlayHeader.js.map +1 -1
- package/build/overlayHeader/OverlayHeader.mjs +0 -1
- package/build/overlayHeader/OverlayHeader.mjs.map +1 -1
- package/build/prompt/InfoPrompt/InfoPrompt.js +0 -2
- package/build/prompt/InfoPrompt/InfoPrompt.js.map +1 -1
- package/build/prompt/InfoPrompt/InfoPrompt.mjs +0 -2
- package/build/prompt/InfoPrompt/InfoPrompt.mjs.map +1 -1
- package/build/styles/css/neptune.css +69 -1
- package/build/styles/fonts/WiseSansJP-Heavy.woff2 +0 -0
- package/build/styles/main.css +69 -5
- package/build/styles/styles/less/neptune.css +69 -1
- package/build/types/common/liveRegion/LiveRegion.d.ts +2 -5
- package/build/types/common/liveRegion/LiveRegion.d.ts.map +1 -1
- package/build/types/prompt/InfoPrompt/InfoPrompt.d.ts.map +1 -1
- package/package.json +4 -4
- package/src/common/liveRegion/LiveRegion.test.tsx +2 -69
- package/src/common/liveRegion/LiveRegion.tsx +8 -77
- package/src/display/Display.story.tsx +15 -1
- package/src/main.css +69 -5
- package/src/main.less +0 -1
- package/src/prompt/InfoPrompt/InfoPrompt.test.story.tsx +5 -142
- package/src/prompt/InfoPrompt/InfoPrompt.test.tsx +6 -11
- package/src/prompt/InfoPrompt/InfoPrompt.tsx +1 -2
- package/src/styles/fonts/WiseSansJP-Heavy.woff2 +0 -0
- package/src/styles/less/core/_fonts.less +13 -0
- package/src/styles/less/core/_typography.less +16 -2
- package/src/styles/less/neptune.css +69 -1
- package/build/styles/common/liveRegion/LiveRegion.css +0 -3
- package/src/common/liveRegion/LiveRegion.css +0 -3
- package/src/common/liveRegion/LiveRegion.less +0 -3
|
@@ -2334,6 +2334,18 @@
|
|
|
2334
2334
|
src: url("styles/fonts/WiseSans-Heavy.woff2") format("woff2");
|
|
2335
2335
|
}
|
|
2336
2336
|
|
|
2337
|
+
/**
|
|
2338
|
+
* 🚨🚨🚨 ONLY FOR TESTING. BE REMOVED BEFORE MERGING 🚨🚨🚨
|
|
2339
|
+
*/
|
|
2340
|
+
|
|
2341
|
+
@font-face {
|
|
2342
|
+
font-family: 'Wise Sans';
|
|
2343
|
+
font-style: normal;
|
|
2344
|
+
font-display: swap;
|
|
2345
|
+
src: url("styles/fonts/WiseSansJP-Heavy.woff2") format('woff2');
|
|
2346
|
+
unicode-range: U+3000-303F, U+3040-309F, U+30A0-30FF, U+FF00-FFEF, U+4E00-9FAF, U+2605, U+2606, U+2190-2195, U+203B;
|
|
2347
|
+
}
|
|
2348
|
+
|
|
2337
2349
|
/* stylelint-disable selector-max-empty-lines */
|
|
2338
2350
|
|
|
2339
2351
|
/*! modern-normalize v3.0.1 | MIT License | https://github.com/sindresorhus/modern-normalize */
|
|
@@ -3492,10 +3504,66 @@ a,
|
|
|
3492
3504
|
.np-text-display-large,
|
|
3493
3505
|
.np-text-display-medium,
|
|
3494
3506
|
.np-text-display-small {
|
|
3495
|
-
font-family:
|
|
3507
|
+
font-family: 'Wise Sans', 'Inter', sans-serif;
|
|
3508
|
+
font-family: var(--font-family-display);
|
|
3496
3509
|
font-synthesis: none;
|
|
3497
3510
|
}
|
|
3498
3511
|
|
|
3512
|
+
:lang(ja) .display-1,
|
|
3513
|
+
:lang(ja) .display-2,
|
|
3514
|
+
:lang(ja) .display-3,
|
|
3515
|
+
:lang(ja) .display-4,
|
|
3516
|
+
:lang(ja) .display-5,
|
|
3517
|
+
:lang(ja) .np-text-display-extra-large,
|
|
3518
|
+
:lang(ja) .np-text-display-large,
|
|
3519
|
+
:lang(ja) .np-text-display-medium,
|
|
3520
|
+
:lang(ja) .np-text-display-small,
|
|
3521
|
+
:lang(id) .display-1,
|
|
3522
|
+
:lang(id) .display-2,
|
|
3523
|
+
:lang(id) .display-3,
|
|
3524
|
+
:lang(id) .display-4,
|
|
3525
|
+
:lang(id) .display-5,
|
|
3526
|
+
:lang(id) .np-text-display-extra-large,
|
|
3527
|
+
:lang(id) .np-text-display-large,
|
|
3528
|
+
:lang(id) .np-text-display-medium,
|
|
3529
|
+
:lang(id) .np-text-display-small,
|
|
3530
|
+
:lang(th) .display-1,
|
|
3531
|
+
:lang(th) .display-2,
|
|
3532
|
+
:lang(th) .display-3,
|
|
3533
|
+
:lang(th) .display-4,
|
|
3534
|
+
:lang(th) .display-5,
|
|
3535
|
+
:lang(th) .np-text-display-extra-large,
|
|
3536
|
+
:lang(th) .np-text-display-large,
|
|
3537
|
+
:lang(th) .np-text-display-medium,
|
|
3538
|
+
:lang(th) .np-text-display-small,
|
|
3539
|
+
:lang(zh-CN) .display-1,
|
|
3540
|
+
:lang(zh-CN) .display-2,
|
|
3541
|
+
:lang(zh-CN) .display-3,
|
|
3542
|
+
:lang(zh-CN) .display-4,
|
|
3543
|
+
:lang(zh-CN) .display-5,
|
|
3544
|
+
:lang(zh-CN) .np-text-display-extra-large,
|
|
3545
|
+
:lang(zh-CN) .np-text-display-large,
|
|
3546
|
+
:lang(zh-CN) .np-text-display-medium,
|
|
3547
|
+
:lang(zh-CN) .np-text-display-small,
|
|
3548
|
+
:lang(zh-HK) .display-1,
|
|
3549
|
+
:lang(zh-HK) .display-2,
|
|
3550
|
+
:lang(zh-HK) .display-3,
|
|
3551
|
+
:lang(zh-HK) .display-4,
|
|
3552
|
+
:lang(zh-HK) .display-5,
|
|
3553
|
+
:lang(zh-HK) .np-text-display-extra-large,
|
|
3554
|
+
:lang(zh-HK) .np-text-display-large,
|
|
3555
|
+
:lang(zh-HK) .np-text-display-medium,
|
|
3556
|
+
:lang(zh-HK) .np-text-display-small {
|
|
3557
|
+
/**
|
|
3558
|
+
* Wise Sans covers extended Latin glyphs for logged-in experiences and a small subset
|
|
3559
|
+
* of Japanese ones for the logged out ones (exposed by the Editorial DS). Unfortunately,
|
|
3560
|
+
* font files are browser-cached and we carried over to launchpad, where it causes issues
|
|
3561
|
+
* for unsupported locales, especially those that share glyphs, like Japanese and Chinese.
|
|
3562
|
+
*/
|
|
3563
|
+
font-family: 'Inter', Helvetica, Arial, sans-serif;
|
|
3564
|
+
font-family: var(--font-family-regular);
|
|
3565
|
+
}
|
|
3566
|
+
|
|
3499
3567
|
/* DEPRECATED(.np-text-display-extra-large): use .np-text-display-large instead */
|
|
3500
3568
|
|
|
3501
3569
|
.np-text-display-extra-large,
|
|
Binary file
|
package/build/styles/main.css
CHANGED
|
@@ -2334,6 +2334,18 @@
|
|
|
2334
2334
|
src: url("styles/fonts/WiseSans-Heavy.woff2") format("woff2");
|
|
2335
2335
|
}
|
|
2336
2336
|
|
|
2337
|
+
/**
|
|
2338
|
+
* 🚨🚨🚨 ONLY FOR TESTING. BE REMOVED BEFORE MERGING 🚨🚨🚨
|
|
2339
|
+
*/
|
|
2340
|
+
|
|
2341
|
+
@font-face {
|
|
2342
|
+
font-family: 'Wise Sans';
|
|
2343
|
+
font-style: normal;
|
|
2344
|
+
font-display: swap;
|
|
2345
|
+
src: url("styles/fonts/WiseSansJP-Heavy.woff2") format('woff2');
|
|
2346
|
+
unicode-range: U+3000-303F, U+3040-309F, U+30A0-30FF, U+FF00-FFEF, U+4E00-9FAF, U+2605, U+2606, U+2190-2195, U+203B;
|
|
2347
|
+
}
|
|
2348
|
+
|
|
2337
2349
|
/* stylelint-disable selector-max-empty-lines */
|
|
2338
2350
|
|
|
2339
2351
|
/*! modern-normalize v3.0.1 | MIT License | https://github.com/sindresorhus/modern-normalize */
|
|
@@ -3492,10 +3504,66 @@ a,
|
|
|
3492
3504
|
.np-text-display-large,
|
|
3493
3505
|
.np-text-display-medium,
|
|
3494
3506
|
.np-text-display-small {
|
|
3495
|
-
font-family:
|
|
3507
|
+
font-family: 'Wise Sans', 'Inter', sans-serif;
|
|
3508
|
+
font-family: var(--font-family-display);
|
|
3496
3509
|
font-synthesis: none;
|
|
3497
3510
|
}
|
|
3498
3511
|
|
|
3512
|
+
:lang(ja) .display-1,
|
|
3513
|
+
:lang(ja) .display-2,
|
|
3514
|
+
:lang(ja) .display-3,
|
|
3515
|
+
:lang(ja) .display-4,
|
|
3516
|
+
:lang(ja) .display-5,
|
|
3517
|
+
:lang(ja) .np-text-display-extra-large,
|
|
3518
|
+
:lang(ja) .np-text-display-large,
|
|
3519
|
+
:lang(ja) .np-text-display-medium,
|
|
3520
|
+
:lang(ja) .np-text-display-small,
|
|
3521
|
+
:lang(id) .display-1,
|
|
3522
|
+
:lang(id) .display-2,
|
|
3523
|
+
:lang(id) .display-3,
|
|
3524
|
+
:lang(id) .display-4,
|
|
3525
|
+
:lang(id) .display-5,
|
|
3526
|
+
:lang(id) .np-text-display-extra-large,
|
|
3527
|
+
:lang(id) .np-text-display-large,
|
|
3528
|
+
:lang(id) .np-text-display-medium,
|
|
3529
|
+
:lang(id) .np-text-display-small,
|
|
3530
|
+
:lang(th) .display-1,
|
|
3531
|
+
:lang(th) .display-2,
|
|
3532
|
+
:lang(th) .display-3,
|
|
3533
|
+
:lang(th) .display-4,
|
|
3534
|
+
:lang(th) .display-5,
|
|
3535
|
+
:lang(th) .np-text-display-extra-large,
|
|
3536
|
+
:lang(th) .np-text-display-large,
|
|
3537
|
+
:lang(th) .np-text-display-medium,
|
|
3538
|
+
:lang(th) .np-text-display-small,
|
|
3539
|
+
:lang(zh-CN) .display-1,
|
|
3540
|
+
:lang(zh-CN) .display-2,
|
|
3541
|
+
:lang(zh-CN) .display-3,
|
|
3542
|
+
:lang(zh-CN) .display-4,
|
|
3543
|
+
:lang(zh-CN) .display-5,
|
|
3544
|
+
:lang(zh-CN) .np-text-display-extra-large,
|
|
3545
|
+
:lang(zh-CN) .np-text-display-large,
|
|
3546
|
+
:lang(zh-CN) .np-text-display-medium,
|
|
3547
|
+
:lang(zh-CN) .np-text-display-small,
|
|
3548
|
+
:lang(zh-HK) .display-1,
|
|
3549
|
+
:lang(zh-HK) .display-2,
|
|
3550
|
+
:lang(zh-HK) .display-3,
|
|
3551
|
+
:lang(zh-HK) .display-4,
|
|
3552
|
+
:lang(zh-HK) .display-5,
|
|
3553
|
+
:lang(zh-HK) .np-text-display-extra-large,
|
|
3554
|
+
:lang(zh-HK) .np-text-display-large,
|
|
3555
|
+
:lang(zh-HK) .np-text-display-medium,
|
|
3556
|
+
:lang(zh-HK) .np-text-display-small {
|
|
3557
|
+
/**
|
|
3558
|
+
* Wise Sans covers extended Latin glyphs for logged-in experiences and a small subset
|
|
3559
|
+
* of Japanese ones for the logged out ones (exposed by the Editorial DS). Unfortunately,
|
|
3560
|
+
* font files are browser-cached and we carried over to launchpad, where it causes issues
|
|
3561
|
+
* for unsupported locales, especially those that share glyphs, like Japanese and Chinese.
|
|
3562
|
+
*/
|
|
3563
|
+
font-family: 'Inter', Helvetica, Arial, sans-serif;
|
|
3564
|
+
font-family: var(--font-family-regular);
|
|
3565
|
+
}
|
|
3566
|
+
|
|
3499
3567
|
/* DEPRECATED(.np-text-display-extra-large): use .np-text-display-large instead */
|
|
3500
3568
|
|
|
3501
3569
|
.np-text-display-extra-large,
|
|
@@ -28096,10 +28164,6 @@ a[data-toggle="tooltip"] {
|
|
|
28096
28164
|
--Card-padding: var(--size-16);
|
|
28097
28165
|
}
|
|
28098
28166
|
|
|
28099
|
-
.wds-LiveRegion {
|
|
28100
|
-
width: 100%;
|
|
28101
|
-
}
|
|
28102
|
-
|
|
28103
28167
|
.np-bottom-sheet {
|
|
28104
28168
|
border-radius: 10px 10px 0 0;
|
|
28105
28169
|
}
|
|
@@ -2334,6 +2334,18 @@
|
|
|
2334
2334
|
src: url("styles/fonts/WiseSans-Heavy.woff2") format("woff2");
|
|
2335
2335
|
}
|
|
2336
2336
|
|
|
2337
|
+
/**
|
|
2338
|
+
* 🚨🚨🚨 ONLY FOR TESTING. BE REMOVED BEFORE MERGING 🚨🚨🚨
|
|
2339
|
+
*/
|
|
2340
|
+
|
|
2341
|
+
@font-face {
|
|
2342
|
+
font-family: 'Wise Sans';
|
|
2343
|
+
font-style: normal;
|
|
2344
|
+
font-display: swap;
|
|
2345
|
+
src: url("styles/fonts/WiseSansJP-Heavy.woff2") format('woff2');
|
|
2346
|
+
unicode-range: U+3000-303F, U+3040-309F, U+30A0-30FF, U+FF00-FFEF, U+4E00-9FAF, U+2605, U+2606, U+2190-2195, U+203B;
|
|
2347
|
+
}
|
|
2348
|
+
|
|
2337
2349
|
/* stylelint-disable selector-max-empty-lines */
|
|
2338
2350
|
|
|
2339
2351
|
/*! modern-normalize v3.0.1 | MIT License | https://github.com/sindresorhus/modern-normalize */
|
|
@@ -3492,10 +3504,66 @@ a,
|
|
|
3492
3504
|
.np-text-display-large,
|
|
3493
3505
|
.np-text-display-medium,
|
|
3494
3506
|
.np-text-display-small {
|
|
3495
|
-
font-family:
|
|
3507
|
+
font-family: 'Wise Sans', 'Inter', sans-serif;
|
|
3508
|
+
font-family: var(--font-family-display);
|
|
3496
3509
|
font-synthesis: none;
|
|
3497
3510
|
}
|
|
3498
3511
|
|
|
3512
|
+
:lang(ja) .display-1,
|
|
3513
|
+
:lang(ja) .display-2,
|
|
3514
|
+
:lang(ja) .display-3,
|
|
3515
|
+
:lang(ja) .display-4,
|
|
3516
|
+
:lang(ja) .display-5,
|
|
3517
|
+
:lang(ja) .np-text-display-extra-large,
|
|
3518
|
+
:lang(ja) .np-text-display-large,
|
|
3519
|
+
:lang(ja) .np-text-display-medium,
|
|
3520
|
+
:lang(ja) .np-text-display-small,
|
|
3521
|
+
:lang(id) .display-1,
|
|
3522
|
+
:lang(id) .display-2,
|
|
3523
|
+
:lang(id) .display-3,
|
|
3524
|
+
:lang(id) .display-4,
|
|
3525
|
+
:lang(id) .display-5,
|
|
3526
|
+
:lang(id) .np-text-display-extra-large,
|
|
3527
|
+
:lang(id) .np-text-display-large,
|
|
3528
|
+
:lang(id) .np-text-display-medium,
|
|
3529
|
+
:lang(id) .np-text-display-small,
|
|
3530
|
+
:lang(th) .display-1,
|
|
3531
|
+
:lang(th) .display-2,
|
|
3532
|
+
:lang(th) .display-3,
|
|
3533
|
+
:lang(th) .display-4,
|
|
3534
|
+
:lang(th) .display-5,
|
|
3535
|
+
:lang(th) .np-text-display-extra-large,
|
|
3536
|
+
:lang(th) .np-text-display-large,
|
|
3537
|
+
:lang(th) .np-text-display-medium,
|
|
3538
|
+
:lang(th) .np-text-display-small,
|
|
3539
|
+
:lang(zh-CN) .display-1,
|
|
3540
|
+
:lang(zh-CN) .display-2,
|
|
3541
|
+
:lang(zh-CN) .display-3,
|
|
3542
|
+
:lang(zh-CN) .display-4,
|
|
3543
|
+
:lang(zh-CN) .display-5,
|
|
3544
|
+
:lang(zh-CN) .np-text-display-extra-large,
|
|
3545
|
+
:lang(zh-CN) .np-text-display-large,
|
|
3546
|
+
:lang(zh-CN) .np-text-display-medium,
|
|
3547
|
+
:lang(zh-CN) .np-text-display-small,
|
|
3548
|
+
:lang(zh-HK) .display-1,
|
|
3549
|
+
:lang(zh-HK) .display-2,
|
|
3550
|
+
:lang(zh-HK) .display-3,
|
|
3551
|
+
:lang(zh-HK) .display-4,
|
|
3552
|
+
:lang(zh-HK) .display-5,
|
|
3553
|
+
:lang(zh-HK) .np-text-display-extra-large,
|
|
3554
|
+
:lang(zh-HK) .np-text-display-large,
|
|
3555
|
+
:lang(zh-HK) .np-text-display-medium,
|
|
3556
|
+
:lang(zh-HK) .np-text-display-small {
|
|
3557
|
+
/**
|
|
3558
|
+
* Wise Sans covers extended Latin glyphs for logged-in experiences and a small subset
|
|
3559
|
+
* of Japanese ones for the logged out ones (exposed by the Editorial DS). Unfortunately,
|
|
3560
|
+
* font files are browser-cached and we carried over to launchpad, where it causes issues
|
|
3561
|
+
* for unsupported locales, especially those that share glyphs, like Japanese and Chinese.
|
|
3562
|
+
*/
|
|
3563
|
+
font-family: 'Inter', Helvetica, Arial, sans-serif;
|
|
3564
|
+
font-family: var(--font-family-regular);
|
|
3565
|
+
}
|
|
3566
|
+
|
|
3499
3567
|
/* DEPRECATED(.np-text-display-extra-large): use .np-text-display-large instead */
|
|
3500
3568
|
|
|
3501
3569
|
.np-text-display-extra-large,
|
|
@@ -1,13 +1,10 @@
|
|
|
1
1
|
import type { HTMLAttributes, ReactNode } from 'react';
|
|
2
2
|
export type AriaLive = 'off' | 'polite' | 'assertive';
|
|
3
|
-
export declare const resetLiveRegionAnnouncementQueue: () => void;
|
|
4
3
|
export interface LiveRegionProps extends Omit<HTMLAttributes<HTMLDivElement>, 'role' | 'aria-live' | 'aria-atomic'> {
|
|
5
4
|
/**
|
|
6
5
|
* Determines urgency: 'assertive' interrupts, 'polite' waits for idle, 'off' disables live region.
|
|
7
6
|
*/
|
|
8
7
|
'aria-live': AriaLive;
|
|
9
|
-
/** Optional stable key that triggers a new announcement when it changes. */
|
|
10
|
-
announceOnChange?: string | number;
|
|
11
8
|
/** Test ID for testing tools */
|
|
12
9
|
'data-testid'?: string;
|
|
13
10
|
children?: ReactNode;
|
|
@@ -17,10 +14,10 @@ export interface LiveRegionProps extends Omit<HTMLAttributes<HTMLDivElement>, 'r
|
|
|
17
14
|
*
|
|
18
15
|
* - `aria-live="polite"` → `role="status"`
|
|
19
16
|
* - `aria-live="assertive"` → `role="alert"`
|
|
20
|
-
* - `aria-live="off"` → no live region
|
|
17
|
+
* - `aria-live="off"` → no live region
|
|
21
18
|
*
|
|
22
19
|
* The `role` prop is intentionally excluded from the public API
|
|
23
20
|
* to prevent mismatches between `aria-live` and `role`.
|
|
24
21
|
*/
|
|
25
|
-
export declare const LiveRegion: ({ "aria-live": ariaLive,
|
|
22
|
+
export declare const LiveRegion: ({ "aria-live": ariaLive, children, ...props }: LiveRegionProps) => import("react").JSX.Element;
|
|
26
23
|
//# sourceMappingURL=LiveRegion.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"LiveRegion.d.ts","sourceRoot":"","sources":["../../../../src/common/liveRegion/LiveRegion.tsx"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"LiveRegion.d.ts","sourceRoot":"","sources":["../../../../src/common/liveRegion/LiveRegion.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,cAAc,EAAE,SAAS,EAAE,MAAM,OAAO,CAAC;AAOvD,MAAM,MAAM,QAAQ,GAAG,KAAK,GAAG,QAAQ,GAAG,WAAW,CAAC;AAEtD,MAAM,WAAW,eAAgB,SAAQ,IAAI,CAC3C,cAAc,CAAC,cAAc,CAAC,EAC9B,MAAM,GAAG,WAAW,GAAG,aAAa,CACrC;IACC;;OAEG;IACH,WAAW,EAAE,QAAQ,CAAC;IACtB,gCAAgC;IAChC,aAAa,CAAC,EAAE,MAAM,CAAC;IACvB,QAAQ,CAAC,EAAE,SAAS,CAAC;CACtB;AAED;;;;;;;;;GASG;AACH,eAAO,MAAM,UAAU,GAAI,+CAA+C,eAAe,gCAgBxF,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"InfoPrompt.d.ts","sourceRoot":"","sources":["../../../../src/prompt/InfoPrompt/InfoPrompt.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,cAAc,EAAE,SAAS,EAAY,MAAM,OAAO,CAAC;AAE5D,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,cAAc,CAAC;AAE7C,OAAO,KAAK,EAAE,SAAS,IAAI,gBAAgB,EAAE,MAAM,wBAAwB,CAAC;AAI5E,OAAa,EAAE,SAAS,EAAE,MAAM,YAAY,CAAC;AAC7C,OAAO,EAAmB,oBAAoB,EAAE,MAAM,oBAAoB,CAAC;AAE3E,MAAM,MAAM,gBAAgB,GAAG,IAAI,CAAC,SAAS,EAAE,MAAM,GAAG,QAAQ,GAAG,SAAS,CAAC,GAAG;IAC9E;;OAEG;IACH,KAAK,EAAE,MAAM,CAAC;CACf,CAAC;AAEF,MAAM,MAAM,eAAe,GAAG;IAC5B;;;OAGG;IACH,KAAK,EAAE,SAAS,CAAC;CAClB,CAAC;AAEF,MAAM,MAAM,eAAe,GAAG,IAAI,CAAC,cAAc,CAAC,cAAc,CAAC,EAAE,OAAO,GAAG,WAAW,GAAG,MAAM,CAAC,GAChG,IAAI,CAAC,oBAAoB,EAAE,aAAa,CAAC,GAAG;IAC1C;;;OAGG;IACH,SAAS,CAAC,EAAE,gBAAgB,CAAC;IAC7B;;;OAGG;IACH,SAAS,CAAC,EAAE,MAAM,IAAI,CAAC;IACvB;;;OAGG;IACH,KAAK,CAAC,EAAE,eAAe,CAAC;IACxB;;OAEG;IACH,MAAM,CAAC,EAAE,gBAAgB,CAAC;IAC1B;;OAEG;IACH,KAAK,CAAC,EAAE,MAAM,CAAC;IACf;;OAEG;IACH,WAAW,EAAE,MAAM,CAAC;IACpB,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB;;;;;;OAMG;IACH,WAAW,CAAC,EAAE,QAAQ,CAAC;CACxB,CAAC;AAEJ;;;;;;;;GAQG;AACH,eAAO,MAAM,UAAU,GAAI,wIAWxB,eAAe,
|
|
1
|
+
{"version":3,"file":"InfoPrompt.d.ts","sourceRoot":"","sources":["../../../../src/prompt/InfoPrompt/InfoPrompt.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,cAAc,EAAE,SAAS,EAAY,MAAM,OAAO,CAAC;AAE5D,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,cAAc,CAAC;AAE7C,OAAO,KAAK,EAAE,SAAS,IAAI,gBAAgB,EAAE,MAAM,wBAAwB,CAAC;AAI5E,OAAa,EAAE,SAAS,EAAE,MAAM,YAAY,CAAC;AAC7C,OAAO,EAAmB,oBAAoB,EAAE,MAAM,oBAAoB,CAAC;AAE3E,MAAM,MAAM,gBAAgB,GAAG,IAAI,CAAC,SAAS,EAAE,MAAM,GAAG,QAAQ,GAAG,SAAS,CAAC,GAAG;IAC9E;;OAEG;IACH,KAAK,EAAE,MAAM,CAAC;CACf,CAAC;AAEF,MAAM,MAAM,eAAe,GAAG;IAC5B;;;OAGG;IACH,KAAK,EAAE,SAAS,CAAC;CAClB,CAAC;AAEF,MAAM,MAAM,eAAe,GAAG,IAAI,CAAC,cAAc,CAAC,cAAc,CAAC,EAAE,OAAO,GAAG,WAAW,GAAG,MAAM,CAAC,GAChG,IAAI,CAAC,oBAAoB,EAAE,aAAa,CAAC,GAAG;IAC1C;;;OAGG;IACH,SAAS,CAAC,EAAE,gBAAgB,CAAC;IAC7B;;;OAGG;IACH,SAAS,CAAC,EAAE,MAAM,IAAI,CAAC;IACvB;;;OAGG;IACH,KAAK,CAAC,EAAE,eAAe,CAAC;IACxB;;OAEG;IACH,MAAM,CAAC,EAAE,gBAAgB,CAAC;IAC1B;;OAEG;IACH,KAAK,CAAC,EAAE,MAAM,CAAC;IACf;;OAEG;IACH,WAAW,EAAE,MAAM,CAAC;IACpB,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB;;;;;;OAMG;IACH,WAAW,CAAC,EAAE,QAAQ,CAAC;CACxB,CAAC;AAEJ;;;;;;;;GAQG;AACH,eAAO,MAAM,UAAU,GAAI,wIAWxB,eAAe,gCA4EjB,CAAC"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@transferwise/components",
|
|
3
|
-
"version": "0.0.0-experimental-
|
|
3
|
+
"version": "0.0.0-experimental-b6ae643",
|
|
4
4
|
"description": "Neptune React components",
|
|
5
5
|
"license": "Apache-2.0",
|
|
6
6
|
"repository": {
|
|
@@ -87,9 +87,9 @@
|
|
|
87
87
|
"storybook-addon-tag-badges": "^3.0.6",
|
|
88
88
|
"storybook-addon-test-codegen": "^3.0.1",
|
|
89
89
|
"@transferwise/less-config": "3.1.2",
|
|
90
|
-
"@transferwise/neptune-css": "
|
|
91
|
-
"@wise/
|
|
92
|
-
"@wise/
|
|
90
|
+
"@transferwise/neptune-css": "0.0.0-experimental-b6ae643",
|
|
91
|
+
"@wise/wds-configs": "0.0.0",
|
|
92
|
+
"@wise/components-theming": "1.10.1"
|
|
93
93
|
},
|
|
94
94
|
"peerDependencies": {
|
|
95
95
|
"@transferwise/icons": "^3 || ^4",
|
|
@@ -1,43 +1,23 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
3
|
-
import { LiveRegion, LiveRegionProps, resetLiveRegionAnnouncementQueue } from './LiveRegion';
|
|
1
|
+
import { render, screen } from '@testing-library/react';
|
|
2
|
+
import { LiveRegion, LiveRegionProps } from './LiveRegion';
|
|
4
3
|
|
|
5
4
|
describe('LiveRegion', () => {
|
|
6
|
-
beforeEach(() => {
|
|
7
|
-
jest.useFakeTimers();
|
|
8
|
-
resetLiveRegionAnnouncementQueue();
|
|
9
|
-
});
|
|
10
|
-
|
|
11
|
-
afterEach(() => {
|
|
12
|
-
jest.clearAllTimers();
|
|
13
|
-
jest.useRealTimers();
|
|
14
|
-
});
|
|
15
|
-
|
|
16
5
|
const renderLiveRegion = (props: Partial<LiveRegionProps> & Pick<LiveRegionProps, 'aria-live'>) =>
|
|
17
6
|
render(<LiveRegion {...props}>{props.children ?? 'Live content'}</LiveRegion>);
|
|
18
7
|
|
|
19
|
-
const enableLiveRegion = (delay = WDS_LIVE_REGION_DELAY_MS) => {
|
|
20
|
-
act(() => {
|
|
21
|
-
jest.advanceTimersByTime(delay);
|
|
22
|
-
});
|
|
23
|
-
};
|
|
24
|
-
|
|
25
8
|
describe('when aria-live is "polite"', () => {
|
|
26
9
|
it('renders with role="status"', () => {
|
|
27
10
|
renderLiveRegion({ 'aria-live': 'polite' });
|
|
28
|
-
enableLiveRegion();
|
|
29
11
|
expect(screen.getByRole('status')).toBeInTheDocument();
|
|
30
12
|
});
|
|
31
13
|
|
|
32
14
|
it('sets aria-live="polite"', () => {
|
|
33
15
|
renderLiveRegion({ 'aria-live': 'polite' });
|
|
34
|
-
enableLiveRegion();
|
|
35
16
|
expect(screen.getByRole('status')).toHaveAttribute('aria-live', 'polite');
|
|
36
17
|
});
|
|
37
18
|
|
|
38
19
|
it('sets aria-atomic="true"', () => {
|
|
39
20
|
renderLiveRegion({ 'aria-live': 'polite' });
|
|
40
|
-
enableLiveRegion();
|
|
41
21
|
expect(screen.getByRole('status')).toHaveAttribute('aria-atomic', 'true');
|
|
42
22
|
});
|
|
43
23
|
});
|
|
@@ -45,79 +25,32 @@ describe('LiveRegion', () => {
|
|
|
45
25
|
describe('when aria-live is "assertive"', () => {
|
|
46
26
|
it('renders with role="alert"', () => {
|
|
47
27
|
renderLiveRegion({ 'aria-live': 'assertive' });
|
|
48
|
-
enableLiveRegion();
|
|
49
28
|
expect(screen.getByRole('alert')).toBeInTheDocument();
|
|
50
29
|
});
|
|
51
30
|
|
|
52
31
|
it('sets aria-live="assertive"', () => {
|
|
53
32
|
renderLiveRegion({ 'aria-live': 'assertive' });
|
|
54
|
-
enableLiveRegion();
|
|
55
33
|
expect(screen.getByRole('alert')).toHaveAttribute('aria-live', 'assertive');
|
|
56
34
|
});
|
|
57
35
|
|
|
58
36
|
it('sets aria-atomic="true"', () => {
|
|
59
37
|
renderLiveRegion({ 'aria-live': 'assertive' });
|
|
60
|
-
enableLiveRegion();
|
|
61
38
|
expect(screen.getByRole('alert')).toHaveAttribute('aria-atomic', 'true');
|
|
62
39
|
});
|
|
63
40
|
});
|
|
64
41
|
|
|
65
|
-
it('delays live-region activation before the configured timeout', () => {
|
|
66
|
-
renderLiveRegion({ 'aria-live': 'polite', children: 'Delayed content' });
|
|
67
|
-
|
|
68
|
-
const liveRegion = screen.getByRole('status');
|
|
69
|
-
expect(liveRegion).toBeInTheDocument();
|
|
70
|
-
expect(liveRegion.firstElementChild).toHaveAttribute('aria-hidden', 'true');
|
|
71
|
-
|
|
72
|
-
enableLiveRegion(WDS_LIVE_REGION_DELAY_MS - 1);
|
|
73
|
-
expect(liveRegion.firstElementChild).toHaveAttribute('aria-hidden', 'true');
|
|
74
|
-
|
|
75
|
-
enableLiveRegion(1);
|
|
76
|
-
expect(liveRegion.firstElementChild).not.toHaveAttribute('aria-hidden');
|
|
77
|
-
expect(liveRegion).toHaveTextContent('Delayed content');
|
|
78
|
-
});
|
|
79
|
-
|
|
80
|
-
it('queues multiple assertive regions so each one gets announced', () => {
|
|
81
|
-
render(
|
|
82
|
-
<>
|
|
83
|
-
<LiveRegion aria-live="assertive">First prompt</LiveRegion>
|
|
84
|
-
<LiveRegion aria-live="assertive">Second prompt</LiveRegion>
|
|
85
|
-
</>,
|
|
86
|
-
);
|
|
87
|
-
|
|
88
|
-
const liveRegions = screen.getAllByRole('alert');
|
|
89
|
-
expect(liveRegions).toHaveLength(2);
|
|
90
|
-
expect(liveRegions[0].firstElementChild).toHaveAttribute('aria-hidden', 'true');
|
|
91
|
-
expect(liveRegions[1].firstElementChild).toHaveAttribute('aria-hidden', 'true');
|
|
92
|
-
|
|
93
|
-
enableLiveRegion();
|
|
94
|
-
const firstEnabledLiveRegions = screen.getAllByRole('alert');
|
|
95
|
-
expect(firstEnabledLiveRegions[0].firstElementChild).not.toHaveAttribute('aria-hidden');
|
|
96
|
-
expect(firstEnabledLiveRegions[1].firstElementChild).toHaveAttribute('aria-hidden', 'true');
|
|
97
|
-
expect(firstEnabledLiveRegions[0]).toHaveTextContent('First prompt');
|
|
98
|
-
|
|
99
|
-
enableLiveRegion();
|
|
100
|
-
const secondEnabledLiveRegions = screen.getAllByRole('alert');
|
|
101
|
-
expect(secondEnabledLiveRegions[1].firstElementChild).not.toHaveAttribute('aria-hidden');
|
|
102
|
-
expect(secondEnabledLiveRegions[0]).toHaveTextContent('First prompt');
|
|
103
|
-
expect(secondEnabledLiveRegions[1]).toHaveTextContent('Second prompt');
|
|
104
|
-
});
|
|
105
|
-
|
|
106
42
|
it('renders children', () => {
|
|
107
43
|
renderLiveRegion({ 'aria-live': 'polite', children: 'Transfer sent' });
|
|
108
|
-
enableLiveRegion();
|
|
109
44
|
expect(screen.getByText('Transfer sent')).toBeInTheDocument();
|
|
110
45
|
});
|
|
111
46
|
|
|
112
47
|
it('passes additional HTML attributes to the wrapper div', () => {
|
|
113
48
|
renderLiveRegion({ 'aria-live': 'polite', className: 'custom' });
|
|
114
|
-
enableLiveRegion();
|
|
115
49
|
expect(screen.getByRole('status')).toHaveClass('custom');
|
|
116
50
|
});
|
|
117
51
|
|
|
118
52
|
it('supports data-testid prop', () => {
|
|
119
53
|
renderLiveRegion({ 'aria-live': 'polite', 'data-testid': 'live-region' });
|
|
120
|
-
enableLiveRegion();
|
|
121
54
|
expect(screen.getByTestId('live-region')).toBeInTheDocument();
|
|
122
55
|
});
|
|
123
56
|
});
|
|
@@ -1,52 +1,11 @@
|
|
|
1
|
-
import { useEffect, useState } from 'react';
|
|
2
1
|
import type { HTMLAttributes, ReactNode } from 'react';
|
|
3
2
|
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
export type AriaLive = 'off' | 'polite' | 'assertive';
|
|
7
|
-
|
|
8
|
-
type LivePoliteness = Exclude<AriaLive, 'off'>;
|
|
9
|
-
|
|
10
|
-
const LIVE_REGION_ROLE_BY_POLITENESS: Record<LivePoliteness, 'status' | 'alert'> = {
|
|
3
|
+
const ARIA_LIVE_ROLE_MAP = {
|
|
11
4
|
assertive: 'alert',
|
|
12
5
|
polite: 'status',
|
|
13
|
-
};
|
|
14
|
-
|
|
15
|
-
let nextPoliteAnnouncementAt = 0;
|
|
16
|
-
let nextAssertiveAnnouncementAt = 0;
|
|
6
|
+
} as const;
|
|
17
7
|
|
|
18
|
-
|
|
19
|
-
if (politeness === 'polite') {
|
|
20
|
-
return nextPoliteAnnouncementAt;
|
|
21
|
-
}
|
|
22
|
-
|
|
23
|
-
return nextAssertiveAnnouncementAt;
|
|
24
|
-
};
|
|
25
|
-
|
|
26
|
-
const setNextAnnouncementAt = (politeness: LivePoliteness, value: number): void => {
|
|
27
|
-
if (politeness === 'polite') {
|
|
28
|
-
nextPoliteAnnouncementAt = value;
|
|
29
|
-
return;
|
|
30
|
-
}
|
|
31
|
-
|
|
32
|
-
nextAssertiveAnnouncementAt = value;
|
|
33
|
-
};
|
|
34
|
-
|
|
35
|
-
export const resetLiveRegionAnnouncementQueue = (): void => {
|
|
36
|
-
nextPoliteAnnouncementAt = 0;
|
|
37
|
-
nextAssertiveAnnouncementAt = 0;
|
|
38
|
-
};
|
|
39
|
-
|
|
40
|
-
const calcAnnouncementDelayMs = (politeness: LivePoliteness, now: number): number => {
|
|
41
|
-
return Math.max(now + WDS_LIVE_REGION_DELAY_MS, getNextAnnouncementAt(politeness)) - now;
|
|
42
|
-
};
|
|
43
|
-
|
|
44
|
-
const scheduleAnnouncement = (politeness: LivePoliteness): number => {
|
|
45
|
-
const now = Date.now();
|
|
46
|
-
const delayMs = calcAnnouncementDelayMs(politeness, now);
|
|
47
|
-
setNextAnnouncementAt(politeness, now + delayMs + WDS_LIVE_REGION_DELAY_MS);
|
|
48
|
-
return delayMs;
|
|
49
|
-
};
|
|
8
|
+
export type AriaLive = 'off' | 'polite' | 'assertive';
|
|
50
9
|
|
|
51
10
|
export interface LiveRegionProps extends Omit<
|
|
52
11
|
HTMLAttributes<HTMLDivElement>,
|
|
@@ -56,8 +15,6 @@ export interface LiveRegionProps extends Omit<
|
|
|
56
15
|
* Determines urgency: 'assertive' interrupts, 'polite' waits for idle, 'off' disables live region.
|
|
57
16
|
*/
|
|
58
17
|
'aria-live': AriaLive;
|
|
59
|
-
/** Optional stable key that triggers a new announcement when it changes. */
|
|
60
|
-
announceOnChange?: string | number;
|
|
61
18
|
/** Test ID for testing tools */
|
|
62
19
|
'data-testid'?: string;
|
|
63
20
|
children?: ReactNode;
|
|
@@ -68,51 +25,25 @@ export interface LiveRegionProps extends Omit<
|
|
|
68
25
|
*
|
|
69
26
|
* - `aria-live="polite"` → `role="status"`
|
|
70
27
|
* - `aria-live="assertive"` → `role="alert"`
|
|
71
|
-
* - `aria-live="off"` → no live region
|
|
28
|
+
* - `aria-live="off"` → no live region
|
|
72
29
|
*
|
|
73
30
|
* The `role` prop is intentionally excluded from the public API
|
|
74
31
|
* to prevent mismatches between `aria-live` and `role`.
|
|
75
32
|
*/
|
|
76
|
-
export const LiveRegion = ({
|
|
77
|
-
'aria-live': ariaLive,
|
|
78
|
-
announceOnChange,
|
|
79
|
-
children,
|
|
80
|
-
className,
|
|
81
|
-
...props
|
|
82
|
-
}: LiveRegionProps) => {
|
|
83
|
-
const [shouldAnnounce, setShouldAnnounce] = useState(false);
|
|
84
|
-
const announcementTrigger =
|
|
85
|
-
announceOnChange ??
|
|
86
|
-
(typeof children === 'string' || typeof children === 'number' ? children : undefined);
|
|
87
|
-
|
|
88
|
-
useEffect(() => {
|
|
89
|
-
setShouldAnnounce(false);
|
|
90
|
-
|
|
91
|
-
if (ariaLive === 'off') {
|
|
92
|
-
return;
|
|
93
|
-
}
|
|
94
|
-
|
|
95
|
-
const timeoutId = window.setTimeout(
|
|
96
|
-
() => setShouldAnnounce(true),
|
|
97
|
-
scheduleAnnouncement(ariaLive),
|
|
98
|
-
);
|
|
99
|
-
|
|
100
|
-
return () => window.clearTimeout(timeoutId);
|
|
101
|
-
}, [ariaLive, announcementTrigger]);
|
|
102
|
-
|
|
33
|
+
export const LiveRegion = ({ 'aria-live': ariaLive, children, ...props }: LiveRegionProps) => {
|
|
103
34
|
if (ariaLive === 'off') {
|
|
104
35
|
return <>{children}</>;
|
|
105
36
|
}
|
|
106
37
|
|
|
107
38
|
return (
|
|
108
39
|
<div
|
|
109
|
-
role={
|
|
40
|
+
role={ARIA_LIVE_ROLE_MAP[ariaLive]}
|
|
110
41
|
aria-live={ariaLive}
|
|
111
42
|
aria-atomic="true"
|
|
112
|
-
|
|
43
|
+
style={{ display: 'contents' }}
|
|
113
44
|
{...props}
|
|
114
45
|
>
|
|
115
|
-
|
|
46
|
+
{children}
|
|
116
47
|
</div>
|
|
117
48
|
);
|
|
118
49
|
};
|
|
@@ -14,6 +14,8 @@ export const Basic = () => {
|
|
|
14
14
|
const DE = 'äöüßabcdefghijklmnopqrstuvwxyz';
|
|
15
15
|
const UA = 'Ми будуємо найбільш міжнародний рахунок у світі';
|
|
16
16
|
const JA = 'ぁあぃいぅうぇえぉおかがきぎくぐけげこごさざしじすずせぜそぞただちぢっつづてで';
|
|
17
|
+
const ZN =
|
|
18
|
+
'的一是在不了有和人这中大为上个国我以要他时来用们生到作地于出就分对成会可主发年样能下过子说产种面而方后多定行学法所民得经十三之进着等部度家电力里如水化高自二理起小物现实加量都两体制机当使点从业本去最性性齉龘龘靐齉爩鱻猋驫麤籲爨癵驫鲙鬯鬻厵纛';
|
|
17
19
|
return (
|
|
18
20
|
<>
|
|
19
21
|
<div lang="en">
|
|
@@ -77,7 +79,7 @@ export const Basic = () => {
|
|
|
77
79
|
</div>
|
|
78
80
|
<hr />
|
|
79
81
|
<div lang="ja">
|
|
80
|
-
<h1>
|
|
82
|
+
<h1>Japanese</h1>
|
|
81
83
|
Large
|
|
82
84
|
<Display type={Typography.DISPLAY_LARGE}>{JA}</Display>
|
|
83
85
|
<hr />
|
|
@@ -87,6 +89,18 @@ export const Basic = () => {
|
|
|
87
89
|
Small
|
|
88
90
|
<Display type={Typography.DISPLAY_SMALL}>{JA}</Display>
|
|
89
91
|
</div>
|
|
92
|
+
<hr />
|
|
93
|
+
<div lang="zh-CN">
|
|
94
|
+
<h1>Simplified Chinese</h1>
|
|
95
|
+
Large
|
|
96
|
+
<Display type={Typography.DISPLAY_LARGE}>{ZN}</Display>
|
|
97
|
+
<hr />
|
|
98
|
+
Medium
|
|
99
|
+
<Display type={Typography.DISPLAY_MEDIUM}>{ZN}</Display>
|
|
100
|
+
<hr />
|
|
101
|
+
Small
|
|
102
|
+
<Display type={Typography.DISPLAY_SMALL}>{ZN}</Display>
|
|
103
|
+
</div>
|
|
90
104
|
</>
|
|
91
105
|
);
|
|
92
106
|
};
|