@transferwise/components 0.0.0-experimental-a90b9c1 → 0.0.0-experimental-6e333ba

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 (144) hide show
  1. package/build/AvatarLayout/AvatarLayout.js.map +1 -1
  2. package/build/AvatarLayout/AvatarLayout.mjs.map +1 -1
  3. package/build/AvatarView/AvatarView.js.map +1 -1
  4. package/build/AvatarView/AvatarView.mjs.map +1 -1
  5. package/build/AvatarView/Dot/Dot.js.map +1 -1
  6. package/build/AvatarView/Dot/Dot.mjs.map +1 -1
  7. package/build/Body/Body.js.map +1 -1
  8. package/build/Body/Body.mjs.map +1 -1
  9. package/build/Chips/Chip/Chip.js.map +1 -1
  10. package/build/Chips/Chip/Chip.mjs.map +1 -1
  11. package/build/Display/Display.js.map +1 -1
  12. package/build/Display/Display.mjs.map +1 -1
  13. package/build/ExpressiveMoneyInput/AmountInput/AmountInput.js.map +1 -1
  14. package/build/ExpressiveMoneyInput/AmountInput/AmountInput.mjs.map +1 -1
  15. package/build/ExpressiveMoneyInput/CurrencySelector/CurrencySelector.js.map +1 -1
  16. package/build/ExpressiveMoneyInput/CurrencySelector/CurrencySelector.mjs.map +1 -1
  17. package/build/ExpressiveMoneyInput/ExpressiveMoneyInput.js.map +1 -1
  18. package/build/ExpressiveMoneyInput/ExpressiveMoneyInput.mjs.map +1 -1
  19. package/build/ExpressiveMoneyInput/hooks/useInputStyle.js.map +1 -1
  20. package/build/ExpressiveMoneyInput/hooks/useInputStyle.mjs.map +1 -1
  21. package/build/IconButton/IconButton.js.map +1 -1
  22. package/build/IconButton/IconButton.mjs.map +1 -1
  23. package/build/Link/Link.js.map +1 -1
  24. package/build/Link/Link.mjs.map +1 -1
  25. package/build/Nudge/Nudge.js.map +1 -1
  26. package/build/Nudge/Nudge.mjs.map +1 -1
  27. package/build/Sticky/Sticky.js +1 -0
  28. package/build/Sticky/Sticky.js.map +1 -1
  29. package/build/Sticky/Sticky.mjs +1 -0
  30. package/build/Sticky/Sticky.mjs.map +1 -1
  31. package/build/Title/Title.js +0 -1
  32. package/build/Title/Title.js.map +1 -1
  33. package/build/Title/Title.mjs +0 -1
  34. package/build/Title/Title.mjs.map +1 -1
  35. package/build/_deprecated/Select/Option/Option.js.map +1 -1
  36. package/build/_deprecated/Select/Option/Option.mjs.map +1 -1
  37. package/build/_deprecated/Select/SearchBox/SearchBox.js.map +1 -1
  38. package/build/_deprecated/Select/SearchBox/SearchBox.mjs.map +1 -1
  39. package/build/common/Circle/Circle.js.map +1 -1
  40. package/build/common/Circle/Circle.mjs.map +1 -1
  41. package/build/main.css +5 -0
  42. package/build/styles/Sticky/Sticky.css +4 -0
  43. package/build/styles/main.css +5 -0
  44. package/build/types/AvatarLayout/AvatarLayout.d.ts +2 -2
  45. package/build/types/AvatarLayout/AvatarLayout.d.ts.map +1 -1
  46. package/build/types/AvatarLayout/index.d.ts +1 -1
  47. package/build/types/AvatarLayout/index.d.ts.map +1 -1
  48. package/build/types/AvatarView/AvatarView.d.ts +2 -2
  49. package/build/types/AvatarView/AvatarView.d.ts.map +1 -1
  50. package/build/types/AvatarView/Dot/Dot.d.ts +1 -1
  51. package/build/types/AvatarView/Dot/Dot.d.ts.map +1 -1
  52. package/build/types/AvatarView/index.d.ts +1 -1
  53. package/build/types/AvatarView/index.d.ts.map +1 -1
  54. package/build/types/Body/Body.d.ts +0 -11
  55. package/build/types/Body/Body.d.ts.map +1 -1
  56. package/build/types/Body/index.d.ts +0 -1
  57. package/build/types/Body/index.d.ts.map +1 -1
  58. package/build/types/Chips/Chip/Chip.d.ts +2 -2
  59. package/build/types/Chips/Chip/Chip.d.ts.map +1 -1
  60. package/build/types/Chips/index.d.ts +1 -1
  61. package/build/types/Chips/index.d.ts.map +1 -1
  62. package/build/types/Display/Display.d.ts +2 -2
  63. package/build/types/Display/Display.d.ts.map +1 -1
  64. package/build/types/Display/index.d.ts +0 -1
  65. package/build/types/Display/index.d.ts.map +1 -1
  66. package/build/types/ExpressiveMoneyInput/AmountInput/AmountInput.d.ts +3 -3
  67. package/build/types/ExpressiveMoneyInput/AmountInput/AmountInput.d.ts.map +1 -1
  68. package/build/types/ExpressiveMoneyInput/CurrencySelector/CurrencySelector.d.ts +3 -3
  69. package/build/types/ExpressiveMoneyInput/CurrencySelector/CurrencySelector.d.ts.map +1 -1
  70. package/build/types/ExpressiveMoneyInput/ExpressiveMoneyInput.d.ts +3 -3
  71. package/build/types/ExpressiveMoneyInput/ExpressiveMoneyInput.d.ts.map +1 -1
  72. package/build/types/ExpressiveMoneyInput/hooks/useInputStyle.d.ts +1 -1
  73. package/build/types/ExpressiveMoneyInput/hooks/useInputStyle.d.ts.map +1 -1
  74. package/build/types/ExpressiveMoneyInput/index.d.ts +1 -1
  75. package/build/types/ExpressiveMoneyInput/index.d.ts.map +1 -1
  76. package/build/types/IconButton/IconButton.d.ts +1 -1
  77. package/build/types/IconButton/IconButton.d.ts.map +1 -1
  78. package/build/types/IconButton/index.d.ts +1 -1
  79. package/build/types/IconButton/index.d.ts.map +1 -1
  80. package/build/types/Link/Link.d.ts +2 -2
  81. package/build/types/Link/Link.d.ts.map +1 -1
  82. package/build/types/Link/index.d.ts +1 -1
  83. package/build/types/Link/index.d.ts.map +1 -1
  84. package/build/types/Nudge/Nudge.d.ts +2 -2
  85. package/build/types/Nudge/Nudge.d.ts.map +1 -1
  86. package/build/types/Nudge/index.d.ts +1 -1
  87. package/build/types/Nudge/index.d.ts.map +1 -1
  88. package/build/types/Sticky/Sticky.d.ts.map +1 -1
  89. package/build/types/Title/Title.d.ts +2 -12
  90. package/build/types/Title/Title.d.ts.map +1 -1
  91. package/build/types/Title/index.d.ts +0 -1
  92. package/build/types/Title/index.d.ts.map +1 -1
  93. package/build/types/_deprecated/Select/Option/Option.d.ts +2 -2
  94. package/build/types/_deprecated/Select/Option/Option.d.ts.map +1 -1
  95. package/build/types/common/Circle/Circle.d.ts +1 -1
  96. package/build/types/common/Circle/Circle.d.ts.map +1 -1
  97. package/build/types/common/Circle/index.d.ts +1 -1
  98. package/build/types/common/Circle/index.d.ts.map +1 -1
  99. package/build/types/index.d.ts +0 -4
  100. package/build/types/index.d.ts.map +1 -1
  101. package/package.json +1 -1
  102. package/src/AvatarLayout/AvatarLayout.tsx +3 -3
  103. package/src/AvatarLayout/index.ts +1 -1
  104. package/src/AvatarView/AvatarView.tsx +4 -4
  105. package/src/AvatarView/Dot/Dot.tsx +1 -1
  106. package/src/AvatarView/index.ts +1 -1
  107. package/src/Body/Body.tsx +2 -2
  108. package/src/Body/index.ts +0 -1
  109. package/src/Chips/Chip/Chip.tsx +2 -2
  110. package/src/Chips/index.ts +1 -1
  111. package/src/Display/Display.tsx +2 -2
  112. package/src/Display/index.ts +0 -1
  113. package/src/Drawer/Drawer.test.tsx +3 -2
  114. package/src/ExpressiveMoneyInput/AmountInput/AmountInput.tsx +3 -3
  115. package/src/ExpressiveMoneyInput/CurrencySelector/CurrencySelector.tsx +3 -3
  116. package/src/ExpressiveMoneyInput/ExpressiveMoneyInput.test.tsx +1 -1
  117. package/src/ExpressiveMoneyInput/ExpressiveMoneyInput.tsx +6 -3
  118. package/src/ExpressiveMoneyInput/_stories/ExpressiveMoneyInput.story.tsx +1 -1
  119. package/src/ExpressiveMoneyInput/_stories/ExpressiveMoneyInput.test.story.tsx +1 -1
  120. package/src/ExpressiveMoneyInput/hooks/useInputStyle.ts +1 -1
  121. package/src/ExpressiveMoneyInput/index.ts +1 -1
  122. package/src/IconButton/IconButton.tsx +2 -2
  123. package/src/IconButton/_stories/IconButton.story.tsx +8 -8
  124. package/src/IconButton/index.ts +1 -1
  125. package/src/Link/Link.tsx +2 -2
  126. package/src/Link/index.ts +1 -1
  127. package/src/Nudge/Nudge.tsx +2 -2
  128. package/src/Nudge/index.ts +1 -1
  129. package/src/Sticky/Sticky.css +4 -0
  130. package/src/Sticky/Sticky.less +6 -0
  131. package/src/Sticky/Sticky.test.tsx +1 -0
  132. package/src/Sticky/Sticky.tsx +1 -0
  133. package/src/Sticky/_stories/Sticky.test.story.tsx +177 -0
  134. package/src/Title/Title.tsx +20 -25
  135. package/src/Title/index.ts +0 -1
  136. package/src/_deprecated/LegacyListItem/_stories/LegacyListItem.story.tsx +3 -2
  137. package/src/_deprecated/Select/Option/Option.test.tsx +1 -1
  138. package/src/_deprecated/Select/Option/Option.tsx +2 -2
  139. package/src/_deprecated/Select/SearchBox/SearchBox.tsx +2 -2
  140. package/src/common/Circle/Circle.tsx +2 -2
  141. package/src/common/Circle/index.ts +1 -1
  142. package/src/index.ts +0 -4
  143. package/src/main.css +5 -0
  144. package/src/main.less +1 -0
@@ -18,7 +18,7 @@ import {
18
18
  createSandboxStory,
19
19
  globalScope,
20
20
  } from '../../../.storybook/components/sandbox/SandboxEditor';
21
- import IconButton, { type IconButtonProps } from '../IconButton';
21
+ import IconButton, { Props } from '../IconButton';
22
22
  import SentimentSurface from '../../SentimentSurface';
23
23
 
24
24
  /**
@@ -46,7 +46,7 @@ export default {
46
46
 
47
47
  type Story = StoryObj<typeof IconButton>;
48
48
 
49
- const sizes: IconButtonProps['size'][] = [16, 24, 32, 40, 48, 56, 72];
49
+ const sizes: Props['size'][] = [16, 24, 32, 40, 48, 56, 72];
50
50
 
51
51
  /**
52
52
  * Explore size, priority, type, and disabled state via the controls panel.
@@ -107,7 +107,7 @@ export const Priority: Story = {
107
107
  </div>
108
108
  ),
109
109
  ],
110
- render: (args: IconButtonProps) => (
110
+ render: (args: Props) => (
111
111
  <>
112
112
  <IconButton priority="primary" type={args.type} aria-label="Primary" onClick={fn()}>
113
113
  <Plus />
@@ -152,7 +152,7 @@ export const Type: Story = {
152
152
  </div>
153
153
  ),
154
154
  ],
155
- render: (args: IconButtonProps) => (
155
+ render: (args: Props) => (
156
156
  <>
157
157
  <IconButton priority={args.priority} type="default" aria-label="Default" onClick={fn()}>
158
158
  <Plus />
@@ -195,7 +195,7 @@ export const Size: Story = {
195
195
  </div>
196
196
  ),
197
197
  ],
198
- render: (args: IconButtonProps) => (
198
+ render: (args: Props) => (
199
199
  <>
200
200
  {sizes.map((size) => (
201
201
  <div
@@ -254,7 +254,7 @@ export const Disabled: Story = {
254
254
  target: { table: { disable: true } },
255
255
  onClick: { table: { disable: true } },
256
256
  },
257
- render: (args: IconButtonProps) => (
257
+ render: (args: Props) => (
258
258
  <IconButton disabled priority={args.priority} type={args.type} aria-label="Disabled">
259
259
  <Plus />
260
260
  </IconButton>
@@ -284,7 +284,7 @@ export const AsAnchor: Story = {
284
284
  disabled: { table: { disable: true } },
285
285
  onClick: { table: { disable: true } },
286
286
  },
287
- render: (args: IconButtonProps) => (
287
+ render: (args: Props) => (
288
288
  <IconButton {...args} aria-label="External link">
289
289
  <ArrowLeft />
290
290
  </IconButton>
@@ -305,7 +305,7 @@ export const SentimentAwareness: Story = {
305
305
  options: [16, 24, 32, 40, 48, 56, 72],
306
306
  },
307
307
  },
308
- render: (args: IconButtonProps) => {
308
+ render: (args: Props) => {
309
309
  const priorities = [
310
310
  { key: 'primary', label: 'primary' },
311
311
  { key: 'secondary', label: 'secondary' },
@@ -1,2 +1,2 @@
1
- export type { IconButtonProps } from './IconButton';
1
+ export type { Props as IconButtonProps } from './IconButton';
2
2
  export { default } from './IconButton';
package/src/Link/Link.tsx CHANGED
@@ -8,7 +8,7 @@ import { LinkLarge, LinkDefault, Typography } from '../common';
8
8
 
9
9
  import messages from './Link.messages';
10
10
 
11
- export type LinkProps = PrimitiveAnchorProps &
11
+ export type Props = PrimitiveAnchorProps &
12
12
  Pick<PrimitiveButtonProps, 'onClick'> & { type?: LinkLarge | LinkDefault };
13
13
 
14
14
  /**
@@ -26,7 +26,7 @@ const Link = ({
26
26
  onClick,
27
27
  disabled,
28
28
  ...props
29
- }: LinkProps) => {
29
+ }: Props) => {
30
30
  const { formatMessage } = useIntl();
31
31
  const isButton = Boolean(onClick) && href === undefined;
32
32
  const isBlank = target === '_blank';
package/src/Link/index.ts CHANGED
@@ -1,2 +1,2 @@
1
1
  export { default } from './Link';
2
- export type { LinkProps } from './Link';
2
+ export type { Props as LinkProps } from './Link';
@@ -81,7 +81,7 @@ export interface RequiredPersistProps extends BaseProps {
81
81
  isPreviouslyDismissed?: (value: boolean) => void;
82
82
  }
83
83
 
84
- export type NudgeProps = OptionalId | RequiredPersistProps;
84
+ export type Props = OptionalId | RequiredPersistProps;
85
85
 
86
86
  const Nudge = ({
87
87
  mediaName,
@@ -95,7 +95,7 @@ const Nudge = ({
95
95
  id,
96
96
  className,
97
97
  action,
98
- }: NudgeProps) => {
98
+ }: Props) => {
99
99
  const intl = useIntl();
100
100
  const getIsDismissed = useCallback(
101
101
  () => (persistDismissal && id ? !!getLocalStorage()?.find((item) => item === id) : false),
@@ -1,7 +1,7 @@
1
1
  export { default } from './Nudge';
2
2
 
3
3
  export type {
4
- NudgeProps,
4
+ Props as NudgeProps,
5
5
  OptionalId as NudgeOptionalId,
6
6
  RequiredPersistProps as NudgeRequiredPersistProps,
7
7
  } from './Nudge';
@@ -0,0 +1,4 @@
1
+ .wds-sticky.sliding-panel--open-bottom {
2
+ padding-bottom: env(safe-area-inset-bottom, 0px);
3
+ padding-bottom: var(--wds-sticky-safe-area-inset-bottom, env(safe-area-inset-bottom, 0px));
4
+ }
@@ -0,0 +1,6 @@
1
+ .wds-sticky.sliding-panel--open-bottom {
2
+ padding-bottom: var(
3
+ --wds-sticky-safe-area-inset-bottom,
4
+ env(safe-area-inset-bottom, 0px)
5
+ );
6
+ }
@@ -21,6 +21,7 @@ describe('Sticky', () => {
21
21
 
22
22
  test('renders with default props', () => {
23
23
  expect(screen.getByTestId('test-sticky-panel')).toBeVisible();
24
+ expect(screen.getByTestId('test-sticky-panel')).toHaveClass('wds-sticky');
24
25
  expect(screen.getByTestId('test-sticky-panel')).toHaveClass('sliding-panel--open-bottom');
25
26
  expect(screen.getByText('Test Content')).toBeInTheDocument();
26
27
  });
@@ -46,6 +46,7 @@ const Sticky: FunctionComponent<StickyProps> = ({
46
46
  }: StickyProps) => {
47
47
  return (
48
48
  <SlidingPanel
49
+ className="wds-sticky"
49
50
  testId={testId}
50
51
  open={open}
51
52
  position={position}
@@ -0,0 +1,177 @@
1
+ import type { Meta, StoryObj } from '@storybook/react-webpack5';
2
+ import { Card, Home, Payments, Recipients } from '@transferwise/icons';
3
+ import type { CSSProperties } from 'react';
4
+ import { useState } from 'react';
5
+ import { expect, userEvent, within } from 'storybook/test';
6
+
7
+ import { withVariantConfig } from '../../../.storybook/helpers';
8
+ import Button from '../../Button';
9
+ import { wait } from '../../test-utils/wait';
10
+ import Sticky from '../Sticky';
11
+
12
+ const SAFE_AREA_INSET = 64;
13
+ const DEMO_HEIGHT = 400;
14
+ const DEMO_WIDTH = 390;
15
+ const SAFE_AREA_VIEWPORT = 'safe-area-demo';
16
+
17
+ type SafeAreaDemoStyle = CSSProperties & {
18
+ '--wds-sticky-safe-area-inset-bottom': string;
19
+ };
20
+
21
+ const safeAreaDemoStyle: SafeAreaDemoStyle = {
22
+ '--wds-sticky-safe-area-inset-bottom': `${SAFE_AREA_INSET}px`,
23
+ background: 'var(--color-background-screen)',
24
+ height: DEMO_HEIGHT,
25
+ overflow: 'hidden',
26
+ };
27
+
28
+ const navigationItems = [
29
+ { Icon: Home, label: 'Home' },
30
+ { Icon: Card, label: 'Card' },
31
+ { Icon: Recipients, label: 'Recipients' },
32
+ { Icon: Payments, label: 'Payments' },
33
+ ] as const;
34
+
35
+ function SafeAreaBottomBar() {
36
+ return (
37
+ <nav
38
+ aria-label="Safe area bottom bar"
39
+ data-testid="safe-area-bottom-bar"
40
+ style={{
41
+ alignItems: 'center',
42
+ background: 'var(--color-background-elevated)',
43
+ borderTop: '1px solid var(--color-border-neutral)',
44
+ bottom: 0,
45
+ display: 'flex',
46
+ height: SAFE_AREA_INSET,
47
+ justifyContent: 'space-around',
48
+ left: 0,
49
+ padding: '0 8px',
50
+ position: 'fixed',
51
+ right: 0,
52
+ zIndex: 1031,
53
+ }}
54
+ >
55
+ {navigationItems.map(({ Icon, label }) => (
56
+ <span
57
+ key={label}
58
+ style={{
59
+ alignItems: 'center',
60
+ color: 'var(--color-content-primary)',
61
+ display: 'flex',
62
+ flexDirection: 'column',
63
+ fontSize: 11,
64
+ gap: 2,
65
+ }}
66
+ >
67
+ <Icon size={24} />
68
+ {label}
69
+ </span>
70
+ ))}
71
+ </nav>
72
+ );
73
+ }
74
+
75
+ function SafeAreaDemo() {
76
+ const [open, setOpen] = useState(false);
77
+
78
+ return (
79
+ <main style={safeAreaDemoStyle}>
80
+ <section style={{ maxWidth: 520, padding: 32 }}>
81
+ <h1 style={{ fontSize: 32, lineHeight: 1.15, margin: '0 0 16px' }}>
82
+ Sticky respects safe area at bottom of screen
83
+ </h1>
84
+ <Button v2 onClick={() => setOpen((currentOpen) => !currentOpen)}>
85
+ {open ? 'Hide Sticky' : 'Show Sticky'}
86
+ </Button>
87
+ </section>
88
+
89
+ <SafeAreaBottomBar />
90
+
91
+ <Sticky open={open} position="bottom" testId="safe-area-sticky">
92
+ <div className="p-a-2" data-testid="sticky-content">
93
+ Sticky
94
+ </div>
95
+ </Sticky>
96
+ </main>
97
+ );
98
+ }
99
+
100
+ const meta = {
101
+ component: Sticky,
102
+ parameters: {
103
+ controls: { disable: true },
104
+ layout: 'fullscreen',
105
+ },
106
+ tags: ['!autodocs', '!manifest'],
107
+ title: 'Dialogs/Sticky/Tests',
108
+ } satisfies Meta<typeof Sticky>;
109
+
110
+ export default meta;
111
+
112
+ type Story = StoryObj<typeof Sticky>;
113
+
114
+ const SafeAreaRegression: Story = {
115
+ parameters: {
116
+ chromatic: { delay: 500 },
117
+ viewport: {
118
+ options: {
119
+ [SAFE_AREA_VIEWPORT]: {
120
+ name: 'Safe area demo',
121
+ styles: { height: `${DEMO_HEIGHT}px`, width: `${DEMO_WIDTH}px` },
122
+ type: 'mobile',
123
+ },
124
+ },
125
+ },
126
+ },
127
+ globals: {
128
+ viewport: SAFE_AREA_VIEWPORT,
129
+ },
130
+ play: async ({ canvasElement, step }) => {
131
+ const canvas = within(canvasElement);
132
+
133
+ const expectStickyAboveSafeArea = async () => {
134
+ await wait(400);
135
+
136
+ const sticky = canvas.getByTestId('safe-area-sticky');
137
+ const stickyContent = canvas.getByTestId('sticky-content');
138
+ const safeArea = canvas.getByTestId('safe-area-bottom-bar');
139
+
140
+ await expect(sticky).toBeVisible();
141
+ await expect(window.getComputedStyle(sticky).paddingBottom).toBe(`${SAFE_AREA_INSET}px`);
142
+ await expect(Math.round(stickyContent.getBoundingClientRect().bottom)).toBe(
143
+ Math.round(safeArea.getBoundingClientRect().top),
144
+ );
145
+ await expect(stickyContent.getBoundingClientRect().bottom).toBeLessThanOrEqual(
146
+ safeArea.getBoundingClientRect().top,
147
+ );
148
+ };
149
+
150
+ await step('Open Sticky from the top button', async () => {
151
+ await userEvent.click(canvas.getByRole('button', { name: /^show sticky$/i }));
152
+ });
153
+
154
+ await step('Keep Sticky above the bottom safe area', expectStickyAboveSafeArea);
155
+
156
+ await step('Toggle Sticky closed and open again', async () => {
157
+ const hideStickyButton = canvas.getByRole('button', { name: /^hide sticky$/i });
158
+
159
+ await userEvent.click(hideStickyButton);
160
+ await wait(400);
161
+ await expect(canvas.queryByTestId('safe-area-sticky')).not.toBeInTheDocument();
162
+
163
+ await userEvent.click(canvas.getByRole('button', { name: /^show sticky$/i }));
164
+ await expectStickyAboveSafeArea();
165
+ });
166
+ },
167
+ render: () => <SafeAreaDemo />,
168
+ };
169
+
170
+ /**
171
+ * Reproduces the MobileNav replacement from DS-7193 with a fixed bottom safe area.
172
+ * It verifies that Sticky clears the inset.
173
+ */
174
+ export const MobileNavSafeArea: Story = {
175
+ ...SafeAreaRegression,
176
+ ...withVariantConfig(['mobile'], SafeAreaRegression),
177
+ };
@@ -1,5 +1,5 @@
1
1
  import { clsx } from 'clsx';
2
- import React, { LabelHTMLAttributes, LiHTMLAttributes } from 'react';
2
+ import React, { forwardRef, LabelHTMLAttributes, LiHTMLAttributes } from 'react';
3
3
 
4
4
  import { TitleTypes, Typography, Heading } from '../common';
5
5
 
@@ -13,9 +13,7 @@ const titleTypeMapping = {
13
13
  [Typography.TITLE_GROUP]: 'h5',
14
14
  } as const;
15
15
 
16
- export type TitleProps = LabelHTMLAttributes<
17
- HTMLHeadingElement | HTMLSpanElement | HTMLLabelElement
18
- > &
16
+ type Props = LabelHTMLAttributes<HTMLHeadingElement | HTMLSpanElement | HTMLLabelElement> &
19
17
  LiHTMLAttributes<HTMLLIElement> & {
20
18
  /**
21
19
  * Default value will based one `type` prop
@@ -27,32 +25,29 @@ export type TitleProps = LabelHTMLAttributes<
27
25
  type?: TitleTypes;
28
26
  };
29
27
 
30
- const Title = React.forwardRef<
31
- HTMLHeadingElement | HTMLSpanElement | HTMLLabelElement | HTMLLIElement | HTMLLegendElement,
32
- TitleProps
33
- >(({ as, type = DEFAULT_TYPE, className, ...props }, ref) => {
34
- const mapping = titleTypeMapping[type as keyof typeof titleTypeMapping];
35
- const isTypeSupported = mapping !== undefined;
36
- if (isTypeSupported) {
37
- const HeaderTag = as ?? mapping;
28
+ const Title = React.forwardRef<HTMLHeadingElement | HTMLSpanElement | HTMLLabelElement, Props>(
29
+ ({ as, type = DEFAULT_TYPE, className, ...props }, ref) => {
30
+ const mapping = titleTypeMapping[type as keyof typeof titleTypeMapping];
31
+ const isTypeSupported = mapping !== undefined;
32
+ if (isTypeSupported) {
33
+ const HeaderTag = as ?? mapping;
34
+ return (
35
+ <HeaderTag
36
+ ref={ref as React.Ref<any>}
37
+ {...props}
38
+ className={clsx(`np-text-${type}`, className)}
39
+ />
40
+ );
41
+ }
42
+ const HeaderTag = as ?? titleTypeMapping[DEFAULT_TYPE];
38
43
  return (
39
44
  <HeaderTag
40
45
  ref={ref as React.Ref<any>}
41
46
  {...props}
42
- className={clsx(`np-text-${type}`, className)}
47
+ className={clsx(`np-text-${DEFAULT_TYPE}`, className)}
43
48
  />
44
49
  );
45
- }
46
- const HeaderTag = as ?? titleTypeMapping[DEFAULT_TYPE];
47
- return (
48
- <HeaderTag
49
- ref={ref as React.Ref<any>}
50
- {...props}
51
- className={clsx(`np-text-${DEFAULT_TYPE}`, className)}
52
- />
53
- );
54
- });
55
-
56
- Title.displayName = 'Title';
50
+ },
51
+ );
57
52
 
58
53
  export default Title;
@@ -1,2 +1 @@
1
1
  export { default } from './Title';
2
- export type { TitleProps } from './Title';
@@ -1,11 +1,12 @@
1
1
  import { action } from 'storybook/actions';
2
2
  import { Documents, FastFlag } from '@transferwise/icons';
3
+ import { ComponentProps } from 'react';
3
4
 
4
5
  import { Button, IconButton, List } from '../../..';
5
6
  import AvatarView from '../../../AvatarView';
6
7
  import Info from '../../../Info';
7
8
  import Title from '../../../Title/Title';
8
- import LegacyListItem, { type LegacyListItemProps } from '..';
9
+ import LegacyListItem from '..';
9
10
 
10
11
  /**
11
12
  * > ⚠️ This component is **deprecated** and superseded by the [new ListItem component](?path=/docs/content-listitem--docs)
@@ -21,7 +22,7 @@ const Template = ({
21
22
  title = 'Wise',
22
23
  value = 'We’re building the world’s most international account',
23
24
  ...props
24
- }: Partial<LegacyListItemProps>) => {
25
+ }: Partial<ComponentProps<typeof LegacyListItem>>) => {
25
26
  return <LegacyListItem title={title} value={value} {...props} />;
26
27
  };
27
28
 
@@ -1,7 +1,7 @@
1
1
  import { render, screen } from '@testing-library/react';
2
2
  import { Person } from '@transferwise/icons';
3
3
 
4
- import Option, { type OptionProps } from './Option';
4
+ import Option, { Props as OptionProps } from './Option';
5
5
 
6
6
  describe('Option', () => {
7
7
  const defaultProps: OptionProps<string> = {
@@ -6,7 +6,7 @@ import { cloneElement, ReactElement, ReactNode } from 'react';
6
6
  import Body from '../../../Body';
7
7
  import { Typography } from '../../../common';
8
8
 
9
- export type OptionProps<T> = {
9
+ export type Props<T> = {
10
10
  label: ReactNode;
11
11
  value: T;
12
12
  currency?: string;
@@ -27,7 +27,7 @@ function Option<T>({
27
27
  icon,
28
28
  selected = false,
29
29
  testId,
30
- }: OptionProps<T>) {
30
+ }: Props<T>) {
31
31
  const iconElement = icon
32
32
  ? cloneElement(icon as ReactElement<IdIconProps>, {
33
33
  size: 24,
@@ -4,13 +4,13 @@ import { forwardRef, InputHTMLAttributes } from 'react';
4
4
 
5
5
  import { Input } from '../../../Inputs/Input/Input';
6
6
 
7
- type SearchBoxProps = {
7
+ type Props = {
8
8
  id?: string;
9
9
  classNames?: Record<string, string>;
10
10
  focusedOptionId?: string;
11
11
  } & Pick<InputHTMLAttributes<HTMLInputElement>, 'onChange' | 'onClick' | 'placeholder' | 'value'>;
12
12
 
13
- const SearchBox = forwardRef<HTMLInputElement, SearchBoxProps>(
13
+ const SearchBox = forwardRef<HTMLInputElement, Props>(
14
14
  (
15
15
  {
16
16
  id,
@@ -5,7 +5,7 @@ import { useMedia } from '../hooks/useMedia';
5
5
 
6
6
  export type ShapeSize = 16 | 24 | 32 | 40 | 48 | 56 | 72 | 88 | 96;
7
7
 
8
- export type CircleProps = {
8
+ export type Props = {
9
9
  /**
10
10
  * Modify underlying element, `div` by default
11
11
  */
@@ -64,7 +64,7 @@ const Circle = forwardRef(function Circle(
64
64
  className,
65
65
  style,
66
66
  ...props
67
- }: CircleProps,
67
+ }: Props,
68
68
  ref,
69
69
  ) {
70
70
  const isTinyViewport = useMedia(`(max-width: ${Breakpoint.EXTRA_SMALL}px)`);
@@ -1,2 +1,2 @@
1
1
  export { default } from './Circle';
2
- export { type CircleProps } from './Circle';
2
+ export { type Props as CircleProps } from './Circle';
package/src/index.ts CHANGED
@@ -25,7 +25,6 @@ export type {
25
25
  ButtonProps as LegacyButtonProps,
26
26
  AnchorElementProps,
27
27
  } from './Button';
28
- export type { BodyProps } from './Body';
29
28
  export type { CardProps } from './_deprecated/Card';
30
29
  export type {
31
30
  CarouselProps,
@@ -64,7 +63,6 @@ export type {
64
63
  DefinitionListLayout,
65
64
  } from './DefinitionList';
66
65
  export type { DimmerProps } from './Dimmer';
67
- export type { DisplayProps } from './Display';
68
66
  export type { DrawerProps } from './Drawer';
69
67
  export type { DividerProps } from './Divider';
70
68
  export type { HeaderProps } from './Header';
@@ -91,7 +89,6 @@ export type { TextAreaProps } from './Inputs/TextArea/TextArea';
91
89
  export type { InstructionsListProps } from './InstructionsList';
92
90
  export type { LabelProps, LabelOptionalProps, LabelDescriptionProps } from './Label';
93
91
  export type { LegacyListItemProps } from './_deprecated/LegacyListItem';
94
- export type { LinkProps } from './Link';
95
92
  export type { LoaderProps } from './Loader';
96
93
  export type { MarkdownProps } from './Markdown';
97
94
  export type { ModalProps } from './Modal';
@@ -148,7 +145,6 @@ export type { SwitchOptionProps } from './_deprecated/SwitchOption';
148
145
  export type { TabItem, TabsProps, TabProps, TabListProps, TabPanelProps } from './Tabs';
149
146
  export type { TextareaWithDisplayFormatProps } from './TextareaWithDisplayFormat';
150
147
  export type { TileProps } from './Tile';
151
- export type { TitleProps } from './Title';
152
148
  export type { TooltipProps } from './Tooltip';
153
149
  export type { TypeaheadOption, TypeaheadProps } from './Typeahead';
154
150
  export type { UploadProps } from './Upload';
package/src/main.css CHANGED
@@ -32712,6 +32712,11 @@ html:not([dir="rtl"]) .np-navigation-option {
32712
32712
  will-change: width;
32713
32713
  }
32714
32714
 
32715
+ .wds-sticky.sliding-panel--open-bottom {
32716
+ padding-bottom: env(safe-area-inset-bottom, 0px);
32717
+ padding-bottom: var(--wds-sticky-safe-area-inset-bottom, env(safe-area-inset-bottom, 0px));
32718
+ }
32719
+
32715
32720
  .np-select .np-dropdown-toggle {
32716
32721
  background-color: #ffffff;
32717
32722
  background-color: var(--color-background-screen);
package/src/main.less CHANGED
@@ -78,6 +78,7 @@
78
78
  @import "./Snackbar/Snackbar.less";
79
79
  @import "./StatusIcon/StatusIcon.less";
80
80
  @import "./Stepper/Stepper.less";
81
+ @import "./Sticky/Sticky.less";
81
82
  @import "./_deprecated/Select/Select.less";
82
83
  @import "./SegmentedControl/SegmentedControl.less";
83
84
  @import "./_deprecated/Summary/Summary.less";