@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.
@@ -2257,7 +2257,7 @@ var Card$2 = Card$1;
2257
2257
 
2258
2258
  const Card = ({
2259
2259
  className,
2260
- children,
2260
+ children = null,
2261
2261
  id,
2262
2262
  isDisabled = false,
2263
2263
  isSmall = false,
@@ -2280,7 +2280,10 @@ const Card = ({
2280
2280
  size: isSmall ? 'sm' : 'md',
2281
2281
  isDisabled: isDisabled,
2282
2282
  testId: "close-button",
2283
- onClick: onDismiss
2283
+ onClick: e => {
2284
+ stopPropagation$1(e);
2285
+ onDismiss();
2286
+ }
2284
2287
  }), children]
2285
2288
  });
2286
2289
  };
@@ -10336,10 +10339,12 @@ const PromoCardIndicator = ({
10336
10339
  children,
10337
10340
  label,
10338
10341
  icon,
10342
+ isSmall = false,
10339
10343
  testid,
10340
10344
  ...rest
10341
10345
  }) => {
10342
- const IconComponent = icon && {
10346
+ const isIconString = icon && typeof icon === 'string';
10347
+ const IconComponent = isIconString && {
10343
10348
  check: Check,
10344
10349
  arrow: ArrowRight,
10345
10350
  download: Download
@@ -10353,12 +10358,15 @@ const PromoCardIndicator = ({
10353
10358
  type: Typography.BODY_LARGE_BOLD,
10354
10359
  className: "np-Card-indicatorText",
10355
10360
  children: label
10356
- }), IconComponent && /*#__PURE__*/jsx("span", {
10361
+ }), icon && /*#__PURE__*/jsx(Avatar, {
10362
+ type: AvatarType.ICON,
10363
+ size: isSmall ? 40 : 56,
10364
+ backgroundColor: "var(--Card-indicator-icon-background-color)",
10357
10365
  className: "np-Card-indicatorIcon",
10358
- children: /*#__PURE__*/jsx(IconComponent, {
10366
+ children: IconComponent ? /*#__PURE__*/jsx(IconComponent, {
10359
10367
  size: 24,
10360
10368
  "aria-hidden": "true"
10361
- })
10369
+ }) : icon
10362
10370
  }), children]
10363
10371
  });
10364
10372
  };
@@ -10420,6 +10428,7 @@ const PromoCard = /*#__PURE__*/forwardRef(({
10420
10428
  imageClass,
10421
10429
  imageSource,
10422
10430
  indicatorLabel,
10431
+ indicatorIcon,
10423
10432
  isChecked,
10424
10433
  isDisabled,
10425
10434
  onClick,
@@ -10430,6 +10439,8 @@ const PromoCard = /*#__PURE__*/forwardRef(({
10430
10439
  title,
10431
10440
  type,
10432
10441
  value,
10442
+ isSmall,
10443
+ useDisplayFont = true,
10433
10444
  ...props
10434
10445
  }, reference) => {
10435
10446
  // Set the `checked` state to the value of `defaultChecked` if it is truthy,
@@ -10453,7 +10464,19 @@ const PromoCard = /*#__PURE__*/forwardRef(({
10453
10464
  // Set the icon to `'arrow'` if `href` is truthy and `type` is falsy, or
10454
10465
  // `'download'` if `download` is truthy. If neither condition is true, set
10455
10466
  // `icon` to `undefined`.
10456
- const icon = href && download ? 'download' : href ? 'arrow' : undefined;
10467
+ // Create a function to get icon type
10468
+ const getIconType = () => {
10469
+ if (indicatorIcon) {
10470
+ return indicatorIcon;
10471
+ }
10472
+ if (download) {
10473
+ return 'download';
10474
+ }
10475
+ if (href && !type) {
10476
+ return 'arrow';
10477
+ }
10478
+ return undefined;
10479
+ };
10457
10480
  // Define all class names string based on the values of the `href`, `type`,
10458
10481
  // `checked`, and `className` props.
10459
10482
  const commonClasses = classNames({
@@ -10470,7 +10493,8 @@ const PromoCard = /*#__PURE__*/forwardRef(({
10470
10493
  isDisabled: isDisabled || contextIsDisabled,
10471
10494
  onClick,
10472
10495
  ref: reference,
10473
- 'data-testid': testId
10496
+ 'data-testid': testId,
10497
+ isSmall
10474
10498
  };
10475
10499
  // Object with Anchor props that will be passed to the `a` element. These
10476
10500
  // won't be refurned if set to `isDisabled`
@@ -10498,6 +10522,27 @@ const PromoCard = /*#__PURE__*/forwardRef(({
10498
10522
  ref: reference,
10499
10523
  tabIndex: 0
10500
10524
  } : {};
10525
+ const getTitle = () => {
10526
+ const titleContent = href && !type ? /*#__PURE__*/jsx("a", {
10527
+ className: "np-Card-titleLink",
10528
+ ...anchorProps,
10529
+ children: title
10530
+ }) : title;
10531
+ const titleProps = {
10532
+ id: `${componentId}-title`,
10533
+ as: headingLevel,
10534
+ className: 'np-Card-title'
10535
+ };
10536
+ return useDisplayFont ? /*#__PURE__*/jsx(Display, {
10537
+ type: Typography.DISPLAY_SMALL,
10538
+ ...titleProps,
10539
+ children: titleContent
10540
+ }) : /*#__PURE__*/jsx(Title, {
10541
+ type: Typography.TITLE_SUBSECTION,
10542
+ ...titleProps,
10543
+ children: titleContent
10544
+ });
10545
+ };
10501
10546
  useEffect(() => {
10502
10547
  setChecked(defaultChecked ?? isChecked ?? false);
10503
10548
  }, [defaultChecked, isChecked]);
@@ -10511,17 +10556,7 @@ const PromoCard = /*#__PURE__*/forwardRef(({
10511
10556
  size: 24,
10512
10557
  "aria-hidden": "true"
10513
10558
  })
10514
- }), /*#__PURE__*/jsx(Display, {
10515
- id: `${componentId}-title`,
10516
- as: headingLevel,
10517
- className: "np-Card-title",
10518
- type: Typography.DISPLAY_SMALL,
10519
- children: href && !type ? /*#__PURE__*/jsx("a", {
10520
- className: "np-Card-titleLink",
10521
- ...anchorProps,
10522
- children: title
10523
- }) : title
10524
- }), /*#__PURE__*/jsx(Body, {
10559
+ }), getTitle(), /*#__PURE__*/jsx(Body, {
10525
10560
  className: "np-Card-description",
10526
10561
  children: description
10527
10562
  }), imageSource && /*#__PURE__*/jsx("div", {
@@ -10535,7 +10570,8 @@ const PromoCard = /*#__PURE__*/forwardRef(({
10535
10570
  })
10536
10571
  }), /*#__PURE__*/jsx(PromoCardIndicator, {
10537
10572
  label: indicatorLabel,
10538
- icon: icon
10573
+ icon: getIconType(),
10574
+ isSmall: isSmall
10539
10575
  })]
10540
10576
  });
10541
10577
  });