@transferwise/components 0.0.0-experimental-102c421 → 0.0.0-experimental-151e673

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 (90) hide show
  1. package/build/ProcessIndicator/ProcessIndicator.js +1 -1
  2. package/build/ProcessIndicator/ProcessIndicator.js.map +1 -1
  3. package/build/ProcessIndicator/ProcessIndicator.mjs +1 -1
  4. package/build/ProcessIndicator/ProcessIndicator.mjs.map +1 -1
  5. package/build/SegmentedControl/SegmentedControl.js +9 -2
  6. package/build/SegmentedControl/SegmentedControl.js.map +1 -1
  7. package/build/SegmentedControl/SegmentedControl.mjs +9 -2
  8. package/build/SegmentedControl/SegmentedControl.mjs.map +1 -1
  9. package/build/main.css +54 -62
  10. package/build/styles/AvatarLayout/AvatarLayout.css +26 -9
  11. package/build/styles/AvatarView/AvatarView.css +0 -8
  12. package/build/styles/AvatarView/Dot/Dot.css +0 -8
  13. package/build/styles/CheckboxButton/CheckboxButton.css +0 -3
  14. package/build/styles/SegmentedControl/SegmentedControl.css +2 -1
  15. package/build/styles/SlidingPanel/SlidingPanel.css +0 -8
  16. package/build/styles/UploadInput/UploadItem/UploadItem.css +5 -4
  17. package/build/styles/_deprecated/Badge/Badge.css +2 -4
  18. package/build/styles/css/accordion.css +0 -3
  19. package/build/styles/css/buttons.css +7 -1
  20. package/build/styles/css/chevron.css +0 -3
  21. package/build/styles/css/neptune.css +19 -25
  22. package/build/styles/css/process.css +9 -15
  23. package/build/styles/css/tick.css +3 -6
  24. package/build/styles/main.css +54 -62
  25. package/build/styles/styles/less/accordion.css +0 -3
  26. package/build/styles/styles/less/buttons.css +7 -1
  27. package/build/styles/styles/less/chevron.css +0 -3
  28. package/build/styles/styles/less/neptune.css +19 -25
  29. package/build/styles/styles/less/process.css +9 -15
  30. package/build/styles/styles/less/tick.css +3 -6
  31. package/build/types/SegmentedControl/SegmentedControl.d.ts.map +1 -1
  32. package/package.json +1 -1
  33. package/src/AvatarLayout/AvatarLayout.css +26 -9
  34. package/src/AvatarLayout/AvatarLayout.less +46 -22
  35. package/src/AvatarLayout/_stories/AvatarLayout.test.story.tsx +17 -42
  36. package/src/AvatarView/AvatarView.css +0 -8
  37. package/src/AvatarView/Dot/Dot.css +0 -8
  38. package/src/AvatarView/Dot/Dot.less +1 -7
  39. package/src/Button/_stories/Button.test.story.tsx +1 -1
  40. package/src/Checkbox/_stories/Checkbox.story.tsx +1 -1
  41. package/src/Checkbox/_stories/Checkbox.test.story.tsx +2 -3
  42. package/src/CheckboxButton/CheckboxButton.css +0 -3
  43. package/src/CheckboxButton/CheckboxButton.less +0 -4
  44. package/src/Chevron/_stories/Chevron.test.story.tsx +2 -2
  45. package/src/Field/_stories/Field.test.story.tsx +48 -37
  46. package/src/FlowNavigation/_stories/FlowNavigation.rtl.test.story.tsx +78 -0
  47. package/src/FlowNavigation/_stories/FlowNavigation.test.story.tsx +0 -44
  48. package/src/Header/_stories/Header.test.story.tsx +1 -1
  49. package/src/Info/_stories/Info.rtl.test.story.tsx +10 -35
  50. package/src/Info/_stories/Info.story.tsx +1 -1
  51. package/src/Inputs/SelectInput/_stories/SelectInput.test.story.tsx +1 -1
  52. package/src/Label/_stories/Label.test.story.tsx +35 -22
  53. package/src/ListItem/_stories/subcomponents.tsx +1 -1
  54. package/src/MoneyInput/_stories/MoneyInput.rtl.test.story.tsx +1 -1
  55. package/src/Nudge/_stories/Nudge.test.story.tsx +12 -29
  56. package/src/PhoneNumberInput/_stories/{PhoneNumberInput.rtl.test.story.tsx → PhoneNumberInput.test.story.tsx} +10 -18
  57. package/src/Popover/_stories/Popover.rtl.test.story.tsx +40 -50
  58. package/src/ProcessIndicator/ProcessIndicator.tsx +1 -1
  59. package/src/ProgressBar/_stories/ProgressBar.test.story.tsx +19 -33
  60. package/src/SegmentedControl/SegmentedControl.css +2 -1
  61. package/src/SegmentedControl/SegmentedControl.less +4 -2
  62. package/src/SegmentedControl/SegmentedControl.tsx +8 -2
  63. package/src/SegmentedControl/_stories/SegmentedControl.test.story.tsx +16 -8
  64. package/src/SlidingPanel/SlidingPanel.css +0 -8
  65. package/src/SlidingPanel/SlidingPanel.less +0 -6
  66. package/src/SlidingPanel/_stories/SlidingPanel.rtl.test.story.tsx +3 -4
  67. package/src/Snackbar/_stories/Snackbar.rtl.test.story.tsx +16 -14
  68. package/src/Snackbar/_stories/Snackbar.story.tsx +1 -1
  69. package/src/Snackbar/_stories/Snackbar.test.story.tsx +1 -1
  70. package/src/StatusIcon/_stories/StatusIcon.test.story.tsx +4 -12
  71. package/src/UploadInput/UploadItem/UploadItem.css +5 -4
  72. package/src/UploadInput/UploadItem/UploadItem.less +6 -7
  73. package/src/UploadInput/_stories/UploadInput.test.story.tsx +1 -1
  74. package/src/_deprecated/Badge/Badge.css +2 -4
  75. package/src/_deprecated/Badge/Badge.less +14 -7
  76. package/src/_deprecated/CriticalBanner/_stories/CriticalCommsBanner.test.story.tsx +16 -0
  77. package/src/_deprecated/OverlayHeader/_stories/OverlayHeader.test.story.tsx +0 -15
  78. package/src/main.css +54 -62
  79. package/src/styles/less/accordion.css +0 -3
  80. package/src/styles/less/buttons.css +7 -1
  81. package/src/styles/less/buttons.less +11 -3
  82. package/src/styles/less/chevron.css +0 -3
  83. package/src/styles/less/chevron.less +0 -4
  84. package/src/styles/less/neptune.css +19 -25
  85. package/src/styles/less/process.css +9 -15
  86. package/src/styles/less/process.less +6 -13
  87. package/src/styles/less/tick.css +3 -6
  88. package/src/styles/less/tick.less +3 -7
  89. package/src/Loader/_stories/Loader.test.story.tsx +0 -23
  90. package/src/ProcessIndicator/_stories/ProcessIndicator.test.story.tsx +0 -32
@@ -3,7 +3,7 @@ import { Component } from 'react';
3
3
 
4
4
  import { Status, Size } from '../common';
5
5
 
6
- const radius = { xxs: 5, xs: 11, sm: 22, xl: 61 };
6
+ const radius = { xxs: 6, xs: 11, sm: 22, xl: 61 };
7
7
 
8
8
  const ANIMATION_DURATION_IN_MS = 1500;
9
9
 
@@ -1,6 +1,6 @@
1
1
  import type { Meta, StoryObj } from '@storybook/react-webpack5';
2
2
 
3
- import { useRtlDiffI18n, withRTLDiff } from '../../../.storybook/decorators/RtlDiffDecorator';
3
+ import { withRTLDiff } from '../../../.storybook/decorators/RtlDiffDecorator';
4
4
  import ProgressBar from '..';
5
5
 
6
6
  export default {
@@ -12,36 +12,22 @@ export default {
12
12
  type Story = StoryObj<typeof ProgressBar>;
13
13
 
14
14
  export const RTLDiff: Story = {
15
- render: () => {
16
- const i18n = useRtlDiffI18n();
17
- return (
18
- <>
19
- <ProgressBar
20
- id="progress-bar-with-description"
21
- title={i18n.title1}
22
- description={i18n.description}
23
- progress={{ value: 50, max: 100 }}
24
- textEnd={i18n.textEnd1}
25
- />
26
- <ProgressBar
27
- id="progress-bar-without-description"
28
- title={i18n.title2}
29
- progress={{ value: 800, max: 1000 }}
30
- textEnd={i18n.textEnd2}
31
- />
32
- </>
33
- );
34
- },
35
- ...withRTLDiff({
36
- i18n: {
37
- title1: { ltr: 'Send 5,550 GBP', rtl: 'أرسل ٥٬٥٥٠ جنيه إسترليني' },
38
- description: {
39
- ltr: 'You have 3 days to reach your goal.',
40
- rtl: 'لديك ٣ أيام للوصول إلى هدفك.',
41
- },
42
- textEnd1: { ltr: '200 GBP to go', rtl: '٢٠٠ جنيه إسترليني متبقي' },
43
- title2: { ltr: 'Total limit', rtl: 'الحد الإجمالي' },
44
- textEnd2: { ltr: '200 GBP remaining', rtl: '٢٠٠ جنيه إسترليني متبقي' },
45
- },
46
- }),
15
+ render: () => (
16
+ <>
17
+ <ProgressBar
18
+ id="progress-bar-with-description"
19
+ title="Send 5,550 GBP"
20
+ description="You have 3 days to reach your goal."
21
+ progress={{ value: 50, max: 100 }}
22
+ textEnd="200 GBP to go"
23
+ />
24
+ <ProgressBar
25
+ id="progress-bar-without-description"
26
+ title="Total limit"
27
+ progress={{ value: 800, max: 1000 }}
28
+ textEnd="200 GBP remaining"
29
+ />
30
+ </>
31
+ ),
32
+ ...withRTLDiff(),
47
33
  };
@@ -35,7 +35,8 @@
35
35
  background: var(--color-background-screen);
36
36
  border-radius: 24px;
37
37
  border-radius: var(--size-24);
38
- transition: left 300ms;
38
+ transition: left 300ms,
39
+ right 300ms;
39
40
  }
40
41
  .segmented-control__segments--no-animate::after {
41
42
  transition: none !important;
@@ -12,7 +12,7 @@
12
12
  justify-content: center;
13
13
  align-items: center;
14
14
  background: var(--color-background-neutral);
15
- border-radius: var(--size-24);
15
+ border-radius: var(--size-24);
16
16
  transition: outline 300ms;
17
17
  outline: 2px solid transparent;
18
18
  }
@@ -31,7 +31,9 @@
31
31
  z-index: 0;
32
32
  background: var(--color-background-screen);
33
33
  border-radius: var(--size-24);
34
- transition: left 300ms;
34
+ transition:
35
+ left 300ms,
36
+ right 300ms;
35
37
  }
36
38
 
37
39
  .segmented-control__segments--no-animate::after {
@@ -3,6 +3,7 @@ import { createRef, useEffect, useRef, useState } from 'react';
3
3
 
4
4
  import Body from '../Body';
5
5
  import { Typography } from '../common';
6
+ import { useDirection } from '../common/hooks';
6
7
 
7
8
  type SegmentBase = { id: string; label: string; value: string };
8
9
 
@@ -40,6 +41,7 @@ const SegmentedControl = ({
40
41
  }: SegmentedControlProps) => {
41
42
  const isMountedRef = useRef(false);
42
43
  const [animate, setAnimate] = useState(false);
44
+ const { isRTL } = useDirection();
43
45
 
44
46
  const segmentsRef = useRef<HTMLDivElement>(null);
45
47
 
@@ -62,8 +64,12 @@ const SegmentedControl = ({
62
64
  // This is so we can animate the highlight to the selected segment
63
65
  if (selectedSegmentRef?.current && segmentsRef.current) {
64
66
  const { style } = segmentsRef.current;
65
- style.setProperty('--segment-highlight-width', `${selectedSegmentRef.current.offsetWidth}px`);
66
- style.setProperty('--segment-highlight-x', `${selectedSegmentRef.current.offsetLeft}px`);
67
+ const segment = selectedSegmentRef.current;
68
+ const inlineOffset = isRTL
69
+ ? segmentsRef.current.offsetWidth - segment.offsetLeft - segment.offsetWidth
70
+ : segment.offsetLeft;
71
+ style.setProperty('--segment-highlight-width', `${segment.offsetWidth}px`);
72
+ style.setProperty('--segment-highlight-x', `${inlineOffset}px`);
67
73
  }
68
74
  };
69
75
 
@@ -1,3 +1,4 @@
1
+ import { useState } from 'react';
1
2
  import type { Meta, StoryObj } from '@storybook/react-webpack5';
2
3
  import { withRTLDiff } from '../../../.storybook/decorators/RtlDiffDecorator';
3
4
  import SegmentedControl from '../SegmentedControl';
@@ -22,24 +23,31 @@ const viewSegments = [
22
23
  { id: 'seg-gamma', label: 'Gamma', value: 'gamma', controls: 'panel-gamma' },
23
24
  ] as const;
24
25
 
25
- export const RTLDiff: Story = {
26
- render: () => (
26
+ function InteractiveSegmentedControl() {
27
+ const [inputValue, setInputValue] = useState('one');
28
+ const [viewValue, setViewValue] = useState('beta');
29
+
30
+ return (
27
31
  <>
28
32
  <SegmentedControl
29
33
  name="rtl-input"
30
34
  mode="input"
31
35
  segments={inputSegments}
32
- value="one"
33
- onChange={() => {}}
36
+ value={inputValue}
37
+ onChange={setInputValue}
34
38
  />
35
39
  <SegmentedControl
36
40
  name="rtl-view"
37
41
  mode="view"
38
42
  segments={viewSegments}
39
- value="alpha"
40
- onChange={() => {}}
43
+ value={viewValue}
44
+ onChange={setViewValue}
41
45
  />
42
46
  </>
43
- ),
44
- ...withRTLDiff(),
47
+ );
48
+ }
49
+
50
+ export const RTLDiff: Story = {
51
+ render: () => <InteractiveSegmentedControl />,
52
+ ...withRTLDiff({ width: 'stretch', renderAs: 'iframe' }),
45
53
  };
@@ -73,10 +73,6 @@
73
73
  box-shadow: inset 1px 0 0 0 rgba(0,0,0,0.10196);
74
74
  box-shadow: inset 1px 0 0 0 var(--color-border-neutral);
75
75
  }
76
- [dir="rtl"] .np-theme-personal .sliding-panel.sliding-panel--border-right {
77
- box-shadow: inset -1px 0 0 0 rgba(0,0,0,0.10196);
78
- box-shadow: inset -1px 0 0 0 var(--color-border-neutral);
79
- }
80
76
  .np-theme-personal .sliding-panel.sliding-panel--border-bottom {
81
77
  box-shadow: inset 0 1px 0 0 rgba(0,0,0,0.10196);
82
78
  box-shadow: inset 0 1px 0 0 var(--color-border-neutral);
@@ -85,7 +81,3 @@
85
81
  box-shadow: inset -1px 0 0 0 rgba(0,0,0,0.10196);
86
82
  box-shadow: inset -1px 0 0 0 var(--color-border-neutral);
87
83
  }
88
- [dir="rtl"] .np-theme-personal .sliding-panel.sliding-panel--border-left {
89
- box-shadow: inset 1px 0 0 0 rgba(0,0,0,0.10196);
90
- box-shadow: inset 1px 0 0 0 var(--color-border-neutral);
91
- }
@@ -85,9 +85,6 @@
85
85
 
86
86
  &.sliding-panel--border-right {
87
87
  box-shadow: inset 1px 0 0 0 var(--color-border-neutral);
88
- [dir="rtl"] & {
89
- box-shadow: inset -1px 0 0 0 var(--color-border-neutral);
90
- }
91
88
  }
92
89
 
93
90
  &.sliding-panel--border-bottom {
@@ -96,9 +93,6 @@
96
93
 
97
94
  &.sliding-panel--border-left {
98
95
  box-shadow: inset -1px 0 0 0 var(--color-border-neutral);
99
- [dir="rtl"] & {
100
- box-shadow: inset 1px 0 0 0 var(--color-border-neutral);
101
- }
102
96
  }
103
97
  }
104
98
  }
@@ -11,15 +11,14 @@ export default {
11
11
 
12
12
  type Story = StoryObj<typeof SlidingPanel>;
13
13
 
14
- const iframeDiff = withRTLDiff({ renderAs: 'iframe', width: 'stretch' });
14
+ const iframeDiff = withRTLDiff({ renderAs: 'iframe' });
15
15
 
16
16
  const containerStyle: React.CSSProperties = {
17
17
  position: 'relative',
18
- width: '100%',
18
+ width: 300,
19
19
  height: 120,
20
20
  overflow: 'hidden',
21
- border: '1px solid #f5f5f5',
22
- background: '#f5f5f5',
21
+ border: '1px dashed #ccc',
23
22
  };
24
23
 
25
24
  const panelContentStyle: React.CSSProperties = {
@@ -1,4 +1,4 @@
1
- import { useEffect, useState } from 'react';
1
+ import { useState } from 'react';
2
2
  import type { Meta, StoryObj } from '@storybook/react-webpack5';
3
3
 
4
4
  import { withRTLDiff } from '../../../.storybook/decorators/RtlDiffDecorator';
@@ -6,38 +6,40 @@ import { Snackbar } from '../Snackbar';
6
6
 
7
7
  export default {
8
8
  component: Snackbar,
9
- title: 'Prompts/Snackbar/Tests/RTL Diff',
9
+ title: 'Dialogs/Snackbar/Tests/RTL Diff',
10
10
  tags: ['!autodocs', '!manifest'],
11
11
  } satisfies Meta<typeof Snackbar>;
12
12
 
13
13
  type Story = StoryObj<typeof Snackbar>;
14
14
 
15
15
  const TIMEOUT = 10_000_000;
16
+ const iframeDiff = withRTLDiff({ renderAs: 'iframe' });
16
17
 
17
- function SnackbarStory({ action }: { action?: { label: string } }) {
18
- const [timestamp, setTimestamp] = useState(0);
19
-
20
- useEffect(() => {
21
- // eslint-disable-next-line react-hooks/set-state-in-effect
22
- setTimestamp(1);
23
- }, []);
18
+ function RenderWithAction() {
19
+ const [timestamp] = useState(() => Date.now());
24
20
 
25
21
  return (
26
22
  <Snackbar
27
23
  text={<span>Transfer completed successfully</span>}
28
24
  timestamp={timestamp}
29
25
  timeout={TIMEOUT}
30
- action={action}
26
+ action={{ label: 'View' }}
31
27
  />
32
28
  );
33
29
  }
34
30
 
31
+ function RenderWithoutAction() {
32
+ const [timestamp] = useState(() => Date.now());
33
+
34
+ return <Snackbar text={<span>Settings saved</span>} timestamp={timestamp} timeout={TIMEOUT} />;
35
+ }
36
+
35
37
  export const WithAction: Story = {
36
- render: () => <SnackbarStory action={{ label: 'View' }} />,
37
- ...withRTLDiff({ renderAs: 'iframe' }),
38
+ render: () => <RenderWithAction />,
39
+ ...iframeDiff,
38
40
  };
39
41
 
40
42
  export const WithoutAction: Story = {
41
- render: () => <SnackbarStory />,
42
- ...withRTLDiff({ renderAs: 'iframe' }),
43
+ render: () => <RenderWithoutAction />,
44
+ ...iframeDiff,
43
45
  };
@@ -13,7 +13,7 @@ import SnackbarProvider from '../SnackbarProvider';
13
13
 
14
14
  const meta: Meta = {
15
15
  component: Snackbar,
16
- title: 'Prompts/Snackbar',
16
+ title: 'Dialogs/Snackbar',
17
17
  };
18
18
  export default meta;
19
19
 
@@ -9,7 +9,7 @@ import { SnackbarConsumer } from '../SnackbarContext';
9
9
  import SnackbarProvider from '../SnackbarProvider';
10
10
 
11
11
  export default {
12
- title: 'Prompts/Snackbar/Tests',
12
+ title: 'Dialogs/Snackbar/Tests',
13
13
  component: Snackbar,
14
14
  argTypes: {},
15
15
  tags: ['!autodocs', '!manifest'],
@@ -1,8 +1,8 @@
1
1
  import { Meta, StoryObj } from '@storybook/react-webpack5';
2
2
 
3
- import { withRTLDiff } from '../../../.storybook/decorators/RtlDiffDecorator';
4
3
  import { Sentiment, Size } from '../../common';
5
4
  import SentimentSurface from '../../SentimentSurface';
5
+ import { withVariantConfig } from '../../../.storybook/helpers';
6
6
 
7
7
  import StatusIcon, { StatusIconSentiment } from '../StatusIcon';
8
8
 
@@ -90,17 +90,9 @@ export const Variants: Story = {
90
90
  },
91
91
  };
92
92
 
93
- export const RTLDiff: Story = {
94
- render: () => (
95
- <>
96
- <StatusIcon sentiment="positive" />
97
- <StatusIcon sentiment="negative" />
98
- <StatusIcon sentiment="warning" />
99
- <StatusIcon sentiment="neutral" />
100
- <StatusIcon sentiment="pending" />
101
- </>
102
- ),
103
- ...withRTLDiff(),
93
+ export const RTL: Story = {
94
+ render: Variants.render,
95
+ ...withVariantConfig(['rtl']),
104
96
  };
105
97
 
106
98
  /**
@@ -41,7 +41,8 @@
41
41
  .np-upload-input__item .np-upload-input__title,
42
42
  .np-upload-input__item .np-upload-input__text {
43
43
  margin: 0;
44
- text-align: start;
44
+ -moz-text-align-last: left;
45
+ text-align-last: left;
45
46
  color: #5d7079;
46
47
  color: var(--color-content-secondary);
47
48
  }
@@ -97,7 +98,7 @@
97
98
  justify-content: center;
98
99
  }
99
100
  .np-upload-input__item .np-upload-input__item-action .np-upload-input__item-button:before {
100
- content: "";
101
+ content: '';
101
102
  display: block;
102
103
  inline-size: var(--clickAreaSize);
103
104
  block-size: var(--clickAreaSize);
@@ -152,8 +153,8 @@
152
153
  padding-inline-start: var(--size-16);
153
154
  }
154
155
  .np-upload-input__item .np-upload-input-errors > li::before {
155
- content: "•" ;
156
- content: "•" / "";
156
+ content: '•' ;
157
+ content: '•' / '';
157
158
  position: absolute;
158
159
  display: block;
159
160
  inset-inline-start: 0;
@@ -39,7 +39,7 @@
39
39
  .np-upload-input__title,
40
40
  .np-upload-input__text {
41
41
  margin: 0;
42
- text-align: left;
42
+ text-align-last: left;
43
43
  color: var(--color-content-secondary);
44
44
  }
45
45
 
@@ -64,7 +64,7 @@
64
64
  --buttonTopRightOffset: var(--size-16);
65
65
  // Offset towards the parent's top-right edge
66
66
  // ensuring no overflow on smaller screens
67
- --clickAreaTopRightOffset: calc((var(--clickAreaSize) - var(--iconSize)) * -0.5);
67
+ --clickAreaTopRightOffset: calc((var(--clickAreaSize) - var(--iconSize)) * -.5);
68
68
 
69
69
  position: absolute;
70
70
  right: var(--buttonTopRightOffset);
@@ -84,16 +84,14 @@
84
84
  border: 0;
85
85
  background-color: var(--color-background-neutral);
86
86
  color: var(--color-interactive-primary);
87
- transition:
88
- color,
89
- background-color 0.15s ease-in-out;
87
+ transition: color, background-color 0.15s ease-in-out;
90
88
  outline-offset: 0;
91
89
  display: flex;
92
90
  align-items: center;
93
91
  justify-content: center;
94
92
 
95
93
  &:before {
96
- content: "";
94
+ content: '';
97
95
  display: block;
98
96
  width: var(--clickAreaSize);
99
97
  height: var(--clickAreaSize);
@@ -118,6 +116,7 @@
118
116
  padding: 0;
119
117
 
120
118
  &:hover:not(:has(.np-upload-input__item-button:hover)) {
119
+
121
120
  &:before,
122
121
  & + .np-upload-input__item:before {
123
122
  width: 100%;
@@ -159,7 +158,7 @@
159
158
  padding-left: var(--size-16);
160
159
 
161
160
  &::before {
162
- content: "•" / "";
161
+ content: '•' / '';
163
162
  position: absolute;
164
163
  display: block;
165
164
  left: 0;
@@ -345,5 +345,5 @@ export const RTLDiff: Story = {
345
345
  />
346
346
  </>
347
347
  ),
348
- ...withRTLDiff({ renderAs: 'iframe' }),
348
+ ...withRTLDiff(),
349
349
  };
@@ -15,14 +15,12 @@
15
15
  --badge-border-color: rgba(0, 0, 0, 0.08);
16
16
  }
17
17
  .tw-badge > .tw-badge__children {
18
- --badge-h-side: left;
19
18
  -webkit-mask-image: radial-gradient(circle at top calc(100% - var(--badge-mask-offset) - var(--badge-content-position)) left calc(100% - var(--badge-mask-offset) - var(--badge-content-position)), transparent 0, transparent calc(var(--badge-size) / 2 + var(--badge-mask)), black calc(var(--badge-size) / 2 + var(--badge-mask) + 0.5px));
20
19
  mask-image: radial-gradient(circle at top calc(100% - var(--badge-mask-offset) - var(--badge-content-position)) left calc(100% - var(--badge-mask-offset) - var(--badge-content-position)), transparent 0, transparent calc(var(--badge-size) / 2 + var(--badge-mask)), black calc(var(--badge-size) / 2 + var(--badge-mask) + 0.5px));
21
- -webkit-mask-image: radial-gradient(circle at top calc(100% - var(--badge-mask-offset) - var(--badge-content-position)) var(--badge-h-side) calc(100% - var(--badge-mask-offset) - var(--badge-content-position)), transparent 0, transparent calc(var(--badge-size) / 2 + var(--badge-mask)), black calc(var(--badge-size) / 2 + var(--badge-mask) + 0.5px));
22
- mask-image: radial-gradient(circle at top calc(100% - var(--badge-mask-offset) - var(--badge-content-position)) var(--badge-h-side) calc(100% - var(--badge-mask-offset) - var(--badge-content-position)), transparent 0, transparent calc(var(--badge-size) / 2 + var(--badge-mask)), black calc(var(--badge-size) / 2 + var(--badge-mask) + 0.5px));
23
20
  }
24
21
  [dir="rtl"] .tw-badge > .tw-badge__children {
25
- --badge-h-side: right;
22
+ -webkit-mask-image: radial-gradient(circle at top calc(100% - var(--badge-mask-offset)) right calc(100% - var(--badge-mask-offset)), transparent 0, transparent calc(var(--badge-size) / 2 + var(--badge-mask)), black calc(var(--badge-size) / 2 + var(--badge-mask) + 0.5px));
23
+ mask-image: radial-gradient(circle at top calc(100% - var(--badge-mask-offset)) right calc(100% - var(--badge-mask-offset)), transparent 0, transparent calc(var(--badge-size) / 2 + var(--badge-mask)), black calc(var(--badge-size) / 2 + var(--badge-mask) + 0.5px));
26
24
  }
27
25
  .tw-badge > .tw-badge__content {
28
26
  position: absolute;
@@ -29,19 +29,26 @@
29
29
  }
30
30
 
31
31
  & > &__children {
32
- --badge-h-side: left;
33
-
34
- [dir="rtl"] & {
35
- --badge-h-side: right;
36
- }
32
+ // Not possible to add a logical property (inset-inline-start) to replace left position inside a gradient.
33
+ // RTL direction sorted out with conditional attributes.
37
34
 
38
35
  mask-image: radial-gradient(
39
- circle at top calc(100% - var(--badge-mask-offset) - var(--badge-content-position))
40
- var(--badge-h-side) calc(100% - var(--badge-mask-offset) - var(--badge-content-position)),
36
+ circle at top calc(100% - var(--badge-mask-offset) - var(--badge-content-position)) left
37
+ calc(100% - var(--badge-mask-offset) - var(--badge-content-position)),
41
38
  transparent 0,
42
39
  transparent calc(var(--badge-size) / 2 + var(--badge-mask)),
43
40
  black calc(var(--badge-size) / 2 + var(--badge-mask) + 0.5px)
44
41
  );
42
+
43
+ [dir="rtl"] & {
44
+ mask-image: radial-gradient(
45
+ circle at top calc(100% - var(--badge-mask-offset)) right
46
+ calc(100% - var(--badge-mask-offset)),
47
+ transparent 0,
48
+ transparent calc(var(--badge-size) / 2 + var(--badge-mask)),
49
+ black calc(var(--badge-size) / 2 + var(--badge-mask) + 0.5px)
50
+ );
51
+ }
45
52
  }
46
53
 
47
54
  & > &__content {
@@ -36,6 +36,22 @@ export const Sentiments: Story = {
36
36
  ]),
37
37
  };
38
38
 
39
+ export const RTL: Story = {
40
+ render: (args) => (
41
+ <>
42
+ <CriticalCommsBanner {...args} sentiment="negative" />
43
+ <CriticalCommsBanner {...args} sentiment="warning" />
44
+ <CriticalCommsBanner {...args} sentiment="neutral" />
45
+ </>
46
+ ),
47
+ args: {
48
+ subtitle: 'Add money within the next 30 days',
49
+ action: { label: 'Take action', href: 'https://wise.com' },
50
+ className: 'm-b-1',
51
+ },
52
+ ...withVariantConfig(['rtl']),
53
+ };
54
+
39
55
  export const Mobile: Story = {
40
56
  args: {
41
57
  subtitle: 'Add money within the next 30 days',
@@ -40,18 +40,3 @@ export const RTLDiff: Story = {
40
40
  ),
41
41
  ...withRTLDiff(),
42
42
  };
43
-
44
- export const RTLDiffMobile: Story = {
45
- render: () => (
46
- <OverlayHeader
47
- logo={<Logo />}
48
- avatar={
49
- <AvatarView>
50
- <Person size="24" />
51
- </AvatarView>
52
- }
53
- onClose={() => {}}
54
- />
55
- ),
56
- ...withRTLDiff({ viewport: 'largeMobile' }),
57
- };