@transferwise/components 0.0.0-experimental-26e4e3f → 0.0.0-experimental-45041bc
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/index.js +741 -466
- package/build/index.js.map +1 -1
- package/build/index.mjs +741 -467
- package/build/index.mjs.map +1 -1
- package/build/main.css +135 -0
- package/build/styles/carousel/Carousel.css +135 -0
- package/build/styles/main.css +135 -0
- package/build/types/carousel/Carousel.d.ts +26 -0
- package/build/types/carousel/Carousel.d.ts.map +1 -0
- package/build/types/carousel/index.d.ts +3 -0
- package/build/types/carousel/index.d.ts.map +1 -0
- package/build/types/common/card/Card.d.ts +2 -2
- package/build/types/common/card/Card.d.ts.map +1 -1
- package/build/types/index.d.ts +2 -0
- package/build/types/index.d.ts.map +1 -1
- package/build/types/promoCard/PromoCard.d.ts +16 -5
- package/build/types/promoCard/PromoCard.d.ts.map +1 -1
- package/package.json +5 -5
- package/src/carousel/Carousel.css +135 -0
- package/src/carousel/Carousel.less +133 -0
- package/src/carousel/Carousel.spec.tsx +221 -0
- package/src/carousel/Carousel.story.tsx +63 -0
- package/src/carousel/Carousel.tsx +345 -0
- package/src/carousel/index.ts +3 -0
- package/src/common/card/Card.tsx +51 -43
- package/src/dateLookup/DateLookup.rtl.spec.tsx +1 -3
- package/src/index.ts +2 -0
- package/src/main.css +135 -0
- package/src/main.less +1 -0
- package/src/promoCard/PromoCard.story.tsx +2 -2
- package/src/promoCard/PromoCard.tsx +29 -8
|
@@ -4,15 +4,15 @@ import React, { forwardRef, FunctionComponent, useEffect, useId, useState } from
|
|
|
4
4
|
|
|
5
5
|
import Body from '../body';
|
|
6
6
|
import { Typography } from '../common';
|
|
7
|
-
import Card, { CardProps } from '../common/card';
|
|
7
|
+
import Card, { type CardProps } from '../common/card';
|
|
8
8
|
import Display from '../display';
|
|
9
9
|
import Image from '../image/Image';
|
|
10
10
|
import Title from '../title';
|
|
11
11
|
|
|
12
12
|
import { usePromoCardContext } from './PromoCardContext';
|
|
13
|
-
import PromoCardIndicator, { PromoCardIndicatorProps } from './PromoCardIndicator';
|
|
13
|
+
import PromoCardIndicator, { type PromoCardIndicatorProps } from './PromoCardIndicator';
|
|
14
14
|
|
|
15
|
-
export type ReferenceType = React.Ref<HTMLInputElement>;
|
|
15
|
+
export type ReferenceType = React.Ref<HTMLInputElement> | React.Ref<HTMLDivElement>;
|
|
16
16
|
export type RelatedTypes =
|
|
17
17
|
| ''
|
|
18
18
|
| 'alternate'
|
|
@@ -67,6 +67,9 @@ export interface PromoCardCommonProps {
|
|
|
67
67
|
/** Specify an onClick event handler */
|
|
68
68
|
onClick?: () => void;
|
|
69
69
|
|
|
70
|
+
/** Specify an onKeyDown event handler */
|
|
71
|
+
onKeyDown?: (event: React.KeyboardEvent<HTMLInputElement>) => void;
|
|
72
|
+
|
|
70
73
|
/** Optional prop to specify the ID used for testing */
|
|
71
74
|
testId?: string;
|
|
72
75
|
|
|
@@ -75,6 +78,8 @@ export interface PromoCardCommonProps {
|
|
|
75
78
|
|
|
76
79
|
/** Set to false to use body font style for the title */
|
|
77
80
|
useDisplayFont?: boolean;
|
|
81
|
+
|
|
82
|
+
ref?: ReferenceType;
|
|
78
83
|
}
|
|
79
84
|
|
|
80
85
|
export interface PromoCardLinkProps extends PromoCardCommonProps, Omit<CardProps, 'children'> {
|
|
@@ -90,6 +95,14 @@ export interface PromoCardLinkProps extends PromoCardCommonProps, Omit<CardProps
|
|
|
90
95
|
/** Optionally specify the language of the linked URL */
|
|
91
96
|
hrefLang?: string;
|
|
92
97
|
|
|
98
|
+
/** Optional property that can be pass a ref for the anchor. */
|
|
99
|
+
anchorRef?: React.Ref<HTMLAnchorElement>;
|
|
100
|
+
|
|
101
|
+
/**
|
|
102
|
+
* Optional prop to specify the ID of the anchor element which can be useful when using a ref.
|
|
103
|
+
*/
|
|
104
|
+
anchorId?: string;
|
|
105
|
+
|
|
93
106
|
/**
|
|
94
107
|
* Relationship between the PromoCard href URL and the current page. See
|
|
95
108
|
* [MDN](https://developer.mozilla.org/en-US/docs/Web/HTML/Attributes/rel).
|
|
@@ -104,7 +117,7 @@ export interface PromoCardLinkProps extends PromoCardCommonProps, Omit<CardProps
|
|
|
104
117
|
isChecked?: never;
|
|
105
118
|
tabIndex?: never;
|
|
106
119
|
type?: never;
|
|
107
|
-
|
|
120
|
+
ref?: ReferenceType;
|
|
108
121
|
value?: never;
|
|
109
122
|
}
|
|
110
123
|
|
|
@@ -119,7 +132,7 @@ export interface PromoCardCheckedProps extends PromoCardCommonProps, Omit<CardPr
|
|
|
119
132
|
tabIndex?: number;
|
|
120
133
|
|
|
121
134
|
/** Optional property to provide component Ref */
|
|
122
|
-
|
|
135
|
+
ref?: ReferenceType;
|
|
123
136
|
|
|
124
137
|
/** Optional prop to specify the input type of the PromoCard */
|
|
125
138
|
type?: 'checkbox' | 'radio';
|
|
@@ -130,6 +143,8 @@ export interface PromoCardCheckedProps extends PromoCardCommonProps, Omit<CardPr
|
|
|
130
143
|
/** Only applies to <a />s */
|
|
131
144
|
download?: never;
|
|
132
145
|
href?: never;
|
|
146
|
+
anchorRef?: never;
|
|
147
|
+
anchorId?: never;
|
|
133
148
|
hrefLang?: never;
|
|
134
149
|
rel?: never;
|
|
135
150
|
target?: never;
|
|
@@ -201,6 +216,7 @@ const PromoCard: FunctionComponent<PromoCardProps> = forwardRef(
|
|
|
201
216
|
isChecked,
|
|
202
217
|
isDisabled,
|
|
203
218
|
onClick,
|
|
219
|
+
onKeyDown,
|
|
204
220
|
rel,
|
|
205
221
|
tabIndex,
|
|
206
222
|
target,
|
|
@@ -210,9 +226,11 @@ const PromoCard: FunctionComponent<PromoCardProps> = forwardRef(
|
|
|
210
226
|
value,
|
|
211
227
|
isSmall,
|
|
212
228
|
useDisplayFont = true,
|
|
229
|
+
anchorRef,
|
|
230
|
+
anchorId,
|
|
213
231
|
...props
|
|
214
232
|
},
|
|
215
|
-
|
|
233
|
+
ref: ReferenceType,
|
|
216
234
|
) => {
|
|
217
235
|
// Set the `checked` state to the value of `defaultChecked` if it is truthy,
|
|
218
236
|
// or the value of `isChecked` if it is truthy, or `false` if neither
|
|
@@ -275,7 +293,8 @@ const PromoCard: FunctionComponent<PromoCardProps> = forwardRef(
|
|
|
275
293
|
id: componentId,
|
|
276
294
|
isDisabled: isDisabled || contextIsDisabled,
|
|
277
295
|
onClick,
|
|
278
|
-
|
|
296
|
+
onKeyDown,
|
|
297
|
+
ref,
|
|
279
298
|
'data-testid': testId,
|
|
280
299
|
isSmall,
|
|
281
300
|
};
|
|
@@ -290,6 +309,8 @@ const PromoCard: FunctionComponent<PromoCardProps> = forwardRef(
|
|
|
290
309
|
hrefLang,
|
|
291
310
|
rel,
|
|
292
311
|
target,
|
|
312
|
+
ref: anchorRef,
|
|
313
|
+
id: anchorId,
|
|
293
314
|
}
|
|
294
315
|
: {};
|
|
295
316
|
|
|
@@ -310,7 +331,7 @@ const PromoCard: FunctionComponent<PromoCardProps> = forwardRef(
|
|
|
310
331
|
handleClick();
|
|
311
332
|
}
|
|
312
333
|
},
|
|
313
|
-
ref
|
|
334
|
+
ref,
|
|
314
335
|
tabIndex: 0,
|
|
315
336
|
}
|
|
316
337
|
: {};
|