@transferwise/components 0.0.0-experimental-cce363f → 0.0.0-experimental-0b6dfe0
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.esm.js +56 -20
- package/build/index.esm.js.map +1 -1
- package/build/index.js +56 -20
- package/build/index.js.map +1 -1
- package/build/main.css +1 -1
- package/build/styles/main.css +1 -1
- package/build/styles/promoCard/PromoCard.css +1 -1
- package/build/types/common/card/Card.d.ts.map +1 -1
- package/build/types/common/card/index.d.ts +1 -0
- package/build/types/common/card/index.d.ts.map +1 -1
- package/build/types/promoCard/PromoCard.d.ts +9 -3
- package/build/types/promoCard/PromoCard.d.ts.map +1 -1
- package/build/types/promoCard/PromoCardIndicator.d.ts +5 -3
- package/build/types/promoCard/PromoCardIndicator.d.ts.map +1 -1
- package/package.json +3 -3
- package/src/common/card/Card.tsx +6 -2
- package/src/common/card/index.ts +1 -0
- package/src/main.css +1 -1
- package/src/promoCard/PromoCard.css +1 -1
- package/src/promoCard/PromoCard.less +9 -9
- package/src/promoCard/PromoCard.spec.tsx +1 -0
- package/src/promoCard/PromoCard.story.tsx +90 -30
- package/src/promoCard/PromoCard.tsx +69 -22
- package/src/promoCard/PromoCardIndicator.tsx +20 -8
package/build/index.js
CHANGED
|
@@ -2290,7 +2290,7 @@ var Card$2 = Card$1;
|
|
|
2290
2290
|
|
|
2291
2291
|
const Card = ({
|
|
2292
2292
|
className,
|
|
2293
|
-
children,
|
|
2293
|
+
children = null,
|
|
2294
2294
|
id,
|
|
2295
2295
|
isDisabled = false,
|
|
2296
2296
|
isSmall = false,
|
|
@@ -2313,7 +2313,10 @@ const Card = ({
|
|
|
2313
2313
|
size: isSmall ? 'sm' : 'md',
|
|
2314
2314
|
isDisabled: isDisabled,
|
|
2315
2315
|
testId: "close-button",
|
|
2316
|
-
onClick:
|
|
2316
|
+
onClick: e => {
|
|
2317
|
+
stopPropagation$1(e);
|
|
2318
|
+
onDismiss();
|
|
2319
|
+
}
|
|
2317
2320
|
}), children]
|
|
2318
2321
|
});
|
|
2319
2322
|
};
|
|
@@ -10369,10 +10372,12 @@ const PromoCardIndicator = ({
|
|
|
10369
10372
|
children,
|
|
10370
10373
|
label,
|
|
10371
10374
|
icon,
|
|
10375
|
+
isSmall = false,
|
|
10372
10376
|
testid,
|
|
10373
10377
|
...rest
|
|
10374
10378
|
}) => {
|
|
10375
|
-
const
|
|
10379
|
+
const isIconString = icon && typeof icon === 'string';
|
|
10380
|
+
const IconComponent = isIconString && {
|
|
10376
10381
|
check: icons.Check,
|
|
10377
10382
|
arrow: icons.ArrowRight,
|
|
10378
10383
|
download: icons.Download
|
|
@@ -10386,12 +10391,15 @@ const PromoCardIndicator = ({
|
|
|
10386
10391
|
type: exports.Typography.BODY_LARGE_BOLD,
|
|
10387
10392
|
className: "np-Card-indicatorText",
|
|
10388
10393
|
children: label
|
|
10389
|
-
}),
|
|
10394
|
+
}), icon && /*#__PURE__*/jsxRuntime.jsx(Avatar, {
|
|
10395
|
+
type: exports.AvatarType.ICON,
|
|
10396
|
+
size: isSmall ? 40 : 56,
|
|
10397
|
+
backgroundColor: "var(--Card-indicator-icon-background-color)",
|
|
10390
10398
|
className: "np-Card-indicatorIcon",
|
|
10391
|
-
children: /*#__PURE__*/jsxRuntime.jsx(IconComponent, {
|
|
10399
|
+
children: IconComponent ? /*#__PURE__*/jsxRuntime.jsx(IconComponent, {
|
|
10392
10400
|
size: 24,
|
|
10393
10401
|
"aria-hidden": "true"
|
|
10394
|
-
})
|
|
10402
|
+
}) : icon
|
|
10395
10403
|
}), children]
|
|
10396
10404
|
});
|
|
10397
10405
|
};
|
|
@@ -10453,6 +10461,7 @@ const PromoCard = /*#__PURE__*/React.forwardRef(({
|
|
|
10453
10461
|
imageClass,
|
|
10454
10462
|
imageSource,
|
|
10455
10463
|
indicatorLabel,
|
|
10464
|
+
indicatorIcon,
|
|
10456
10465
|
isChecked,
|
|
10457
10466
|
isDisabled,
|
|
10458
10467
|
onClick,
|
|
@@ -10463,6 +10472,8 @@ const PromoCard = /*#__PURE__*/React.forwardRef(({
|
|
|
10463
10472
|
title,
|
|
10464
10473
|
type,
|
|
10465
10474
|
value,
|
|
10475
|
+
isSmall,
|
|
10476
|
+
useDisplayFont = true,
|
|
10466
10477
|
...props
|
|
10467
10478
|
}, reference) => {
|
|
10468
10479
|
// Set the `checked` state to the value of `defaultChecked` if it is truthy,
|
|
@@ -10486,7 +10497,19 @@ const PromoCard = /*#__PURE__*/React.forwardRef(({
|
|
|
10486
10497
|
// Set the icon to `'arrow'` if `href` is truthy and `type` is falsy, or
|
|
10487
10498
|
// `'download'` if `download` is truthy. If neither condition is true, set
|
|
10488
10499
|
// `icon` to `undefined`.
|
|
10489
|
-
|
|
10500
|
+
// Create a function to get icon type
|
|
10501
|
+
const getIconType = () => {
|
|
10502
|
+
if (indicatorIcon) {
|
|
10503
|
+
return indicatorIcon;
|
|
10504
|
+
}
|
|
10505
|
+
if (download) {
|
|
10506
|
+
return 'download';
|
|
10507
|
+
}
|
|
10508
|
+
if (href && !type) {
|
|
10509
|
+
return 'arrow';
|
|
10510
|
+
}
|
|
10511
|
+
return undefined;
|
|
10512
|
+
};
|
|
10490
10513
|
// Define all class names string based on the values of the `href`, `type`,
|
|
10491
10514
|
// `checked`, and `className` props.
|
|
10492
10515
|
const commonClasses = classNames__default.default({
|
|
@@ -10503,7 +10526,8 @@ const PromoCard = /*#__PURE__*/React.forwardRef(({
|
|
|
10503
10526
|
isDisabled: isDisabled || contextIsDisabled,
|
|
10504
10527
|
onClick,
|
|
10505
10528
|
ref: reference,
|
|
10506
|
-
'data-testid': testId
|
|
10529
|
+
'data-testid': testId,
|
|
10530
|
+
isSmall
|
|
10507
10531
|
};
|
|
10508
10532
|
// Object with Anchor props that will be passed to the `a` element. These
|
|
10509
10533
|
// won't be refurned if set to `isDisabled`
|
|
@@ -10531,6 +10555,27 @@ const PromoCard = /*#__PURE__*/React.forwardRef(({
|
|
|
10531
10555
|
ref: reference,
|
|
10532
10556
|
tabIndex: 0
|
|
10533
10557
|
} : {};
|
|
10558
|
+
const getTitle = () => {
|
|
10559
|
+
const titleContent = href && !type ? /*#__PURE__*/jsxRuntime.jsx("a", {
|
|
10560
|
+
className: "np-Card-titleLink",
|
|
10561
|
+
...anchorProps,
|
|
10562
|
+
children: title
|
|
10563
|
+
}) : title;
|
|
10564
|
+
const titleProps = {
|
|
10565
|
+
id: `${componentId}-title`,
|
|
10566
|
+
as: headingLevel,
|
|
10567
|
+
className: 'np-Card-title'
|
|
10568
|
+
};
|
|
10569
|
+
return useDisplayFont ? /*#__PURE__*/jsxRuntime.jsx(Display, {
|
|
10570
|
+
type: exports.Typography.DISPLAY_SMALL,
|
|
10571
|
+
...titleProps,
|
|
10572
|
+
children: titleContent
|
|
10573
|
+
}) : /*#__PURE__*/jsxRuntime.jsx(Title, {
|
|
10574
|
+
type: exports.Typography.TITLE_SUBSECTION,
|
|
10575
|
+
...titleProps,
|
|
10576
|
+
children: titleContent
|
|
10577
|
+
});
|
|
10578
|
+
};
|
|
10534
10579
|
React.useEffect(() => {
|
|
10535
10580
|
setChecked(defaultChecked ?? isChecked ?? false);
|
|
10536
10581
|
}, [defaultChecked, isChecked]);
|
|
@@ -10544,17 +10589,7 @@ const PromoCard = /*#__PURE__*/React.forwardRef(({
|
|
|
10544
10589
|
size: 24,
|
|
10545
10590
|
"aria-hidden": "true"
|
|
10546
10591
|
})
|
|
10547
|
-
}), /*#__PURE__*/jsxRuntime.jsx(
|
|
10548
|
-
id: `${componentId}-title`,
|
|
10549
|
-
as: headingLevel,
|
|
10550
|
-
className: "np-Card-title",
|
|
10551
|
-
type: exports.Typography.DISPLAY_SMALL,
|
|
10552
|
-
children: href && !type ? /*#__PURE__*/jsxRuntime.jsx("a", {
|
|
10553
|
-
className: "np-Card-titleLink",
|
|
10554
|
-
...anchorProps,
|
|
10555
|
-
children: title
|
|
10556
|
-
}) : title
|
|
10557
|
-
}), /*#__PURE__*/jsxRuntime.jsx(Body, {
|
|
10592
|
+
}), getTitle(), /*#__PURE__*/jsxRuntime.jsx(Body, {
|
|
10558
10593
|
className: "np-Card-description",
|
|
10559
10594
|
children: description
|
|
10560
10595
|
}), imageSource && /*#__PURE__*/jsxRuntime.jsx("div", {
|
|
@@ -10568,7 +10603,8 @@ const PromoCard = /*#__PURE__*/React.forwardRef(({
|
|
|
10568
10603
|
})
|
|
10569
10604
|
}), /*#__PURE__*/jsxRuntime.jsx(PromoCardIndicator, {
|
|
10570
10605
|
label: indicatorLabel,
|
|
10571
|
-
icon:
|
|
10606
|
+
icon: getIconType(),
|
|
10607
|
+
isSmall: isSmall
|
|
10572
10608
|
})]
|
|
10573
10609
|
});
|
|
10574
10610
|
});
|