@transferwise/components 0.0.0-experimental-77f3fcf → 0.0.0-experimental-72aed20

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 (34) hide show
  1. package/build/index.esm.js +31 -60
  2. package/build/index.esm.js.map +1 -1
  3. package/build/index.js +31 -60
  4. package/build/index.js.map +1 -1
  5. package/build/main.css +1 -1
  6. package/build/styles/main.css +1 -1
  7. package/build/styles/promoCard/PromoCard.css +1 -1
  8. package/build/types/common/Option/Option.d.ts.map +1 -1
  9. package/build/types/common/card/Card.d.ts.map +1 -1
  10. package/build/types/common/card/index.d.ts +0 -1
  11. package/build/types/common/card/index.d.ts.map +1 -1
  12. package/build/types/dateInput/DateInput.d.ts +2 -0
  13. package/build/types/dateInput/DateInput.d.ts.map +1 -1
  14. package/build/types/phoneNumberInput/PhoneNumberInput.d.ts.map +1 -1
  15. package/build/types/promoCard/PromoCard.d.ts +3 -9
  16. package/build/types/promoCard/PromoCard.d.ts.map +1 -1
  17. package/build/types/promoCard/PromoCardIndicator.d.ts +3 -5
  18. package/build/types/promoCard/PromoCardIndicator.d.ts.map +1 -1
  19. package/package.json +1 -1
  20. package/src/accordion/AccordionItem/__snapshots__/AccordionItem.spec.js.snap +6 -6
  21. package/src/card/Card.spec.js +2 -2
  22. package/src/common/Option/Option.tsx +1 -7
  23. package/src/common/card/Card.tsx +2 -6
  24. package/src/common/card/index.ts +0 -1
  25. package/src/dateInput/DateInput.js +8 -0
  26. package/src/dateInput/DateInput.story.tsx +2 -0
  27. package/src/main.css +1 -1
  28. package/src/phoneNumberInput/PhoneNumberInput.js +1 -0
  29. package/src/promoCard/PromoCard.css +1 -1
  30. package/src/promoCard/PromoCard.less +9 -9
  31. package/src/promoCard/PromoCard.spec.tsx +0 -1
  32. package/src/promoCard/PromoCard.story.tsx +30 -90
  33. package/src/promoCard/PromoCard.tsx +22 -69
  34. package/src/promoCard/PromoCardIndicator.tsx +8 -20
@@ -611,10 +611,8 @@ const Option$2 = /*#__PURE__*/forwardRef(({
611
611
  })
612
612
  }), /*#__PURE__*/jsxs("div", {
613
613
  className: "media-body",
614
- children: [/*#__PURE__*/jsx(Body, {
615
- as: "span",
616
- type: Typography.BODY_LARGE_BOLD,
617
- className: "text-primary np-option__title d-block",
614
+ children: [/*#__PURE__*/jsx("h4", {
615
+ className: "np-text-body-large-bold text-primary np-option__title",
618
616
  children: title
619
617
  }), content && /*#__PURE__*/jsx(Body, {
620
618
  className: "d-block np-option__body",
@@ -2333,7 +2331,7 @@ var Card$2 = Card$1;
2333
2331
 
2334
2332
  const Card = ({
2335
2333
  className,
2336
- children = null,
2334
+ children,
2337
2335
  id,
2338
2336
  isDisabled = false,
2339
2337
  isSmall = false,
@@ -2356,10 +2354,7 @@ const Card = ({
2356
2354
  size: isSmall ? 'sm' : 'md',
2357
2355
  isDisabled: isDisabled,
2358
2356
  testId: "close-button",
2359
- onClick: e => {
2360
- stopPropagation$1(e);
2361
- onDismiss();
2362
- }
2357
+ onClick: onDismiss
2363
2358
  }), children]
2364
2359
  });
2365
2360
  };
@@ -2722,8 +2717,10 @@ const DateInput = ({
2722
2717
  size,
2723
2718
  value,
2724
2719
  dayLabel,
2720
+ dayAutoComplete,
2725
2721
  monthLabel,
2726
2722
  yearLabel,
2723
+ yearAutoComplete,
2727
2724
  monthFormat,
2728
2725
  mode,
2729
2726
  onChange,
@@ -2921,6 +2918,7 @@ const DateInput = ({
2921
2918
  children: /*#__PURE__*/jsx(Input, {
2922
2919
  type: "number",
2923
2920
  name: "day",
2921
+ autoComplete: dayAutoComplete,
2924
2922
  value: day || '',
2925
2923
  placeholder: placeholders.day,
2926
2924
  disabled: disabled,
@@ -2943,6 +2941,7 @@ const DateInput = ({
2943
2941
  children: /*#__PURE__*/jsx(Input, {
2944
2942
  type: "number",
2945
2943
  name: "year",
2944
+ autoComplete: yearAutoComplete,
2946
2945
  placeholder: placeholders.year,
2947
2946
  value: year || '',
2948
2947
  disabled: disabled,
@@ -2990,8 +2989,10 @@ DateInput.propTypes = {
2990
2989
  onFocus: PropTypes.func,
2991
2990
  onBlur: PropTypes.func,
2992
2991
  dayLabel: PropTypes.string,
2992
+ dayAutoComplete: PropTypes.string,
2993
2993
  monthLabel: PropTypes.string,
2994
2994
  yearLabel: PropTypes.string,
2995
+ yearAutoComplete: PropTypes.string,
2995
2996
  monthFormat: PropTypes.oneOf(['long', 'short']),
2996
2997
  mode: PropTypes.oneOf(['day-month-year', 'month-year']),
2997
2998
  placeholders: PropTypes.shape({
@@ -3008,6 +3009,8 @@ DateInput.defaultProps = {
3008
3009
  value: null,
3009
3010
  onFocus: null,
3010
3011
  onBlur: null,
3012
+ dayAutoComplete: null,
3013
+ yearAutoComplete: null,
3011
3014
  monthFormat: MonthFormat.LONG,
3012
3015
  mode: DateMode.DAY_MONTH_YEAR,
3013
3016
  id: '',
@@ -10097,6 +10100,7 @@ const PhoneNumberInput = props => {
10097
10100
  className: `input-group input-group-${size}`,
10098
10101
  children: /*#__PURE__*/jsx("input", {
10099
10102
  id: id,
10103
+ autoComplete: "tel-national",
10100
10104
  name: "phoneNumber",
10101
10105
  inputMode: "numeric",
10102
10106
  value: internalValue.suffix,
@@ -10348,12 +10352,10 @@ const PromoCardIndicator = ({
10348
10352
  children,
10349
10353
  label,
10350
10354
  icon,
10351
- isSmall = false,
10352
10355
  testid,
10353
10356
  ...rest
10354
10357
  }) => {
10355
- const isIconString = icon && typeof icon === 'string';
10356
- const IconComponent = isIconString && {
10358
+ const IconComponent = icon && {
10357
10359
  check: Check,
10358
10360
  arrow: ArrowRight,
10359
10361
  download: Download
@@ -10367,15 +10369,12 @@ const PromoCardIndicator = ({
10367
10369
  type: Typography.BODY_LARGE_BOLD,
10368
10370
  className: "np-Card-indicatorText",
10369
10371
  children: label
10370
- }), icon && /*#__PURE__*/jsx(Avatar, {
10371
- type: AvatarType.ICON,
10372
- size: isSmall ? 40 : 56,
10373
- backgroundColor: "var(--Card-indicator-icon-background-color)",
10372
+ }), IconComponent && /*#__PURE__*/jsx("span", {
10374
10373
  className: "np-Card-indicatorIcon",
10375
- children: IconComponent ? /*#__PURE__*/jsx(IconComponent, {
10374
+ children: /*#__PURE__*/jsx(IconComponent, {
10376
10375
  size: 24,
10377
10376
  "aria-hidden": "true"
10378
- }) : icon
10377
+ })
10379
10378
  }), children]
10380
10379
  });
10381
10380
  };
@@ -10437,7 +10436,6 @@ const PromoCard = /*#__PURE__*/forwardRef(({
10437
10436
  imageClass,
10438
10437
  imageSource,
10439
10438
  indicatorLabel,
10440
- indicatorIcon,
10441
10439
  isChecked,
10442
10440
  isDisabled,
10443
10441
  onClick,
@@ -10448,8 +10446,6 @@ const PromoCard = /*#__PURE__*/forwardRef(({
10448
10446
  title,
10449
10447
  type,
10450
10448
  value,
10451
- isSmall,
10452
- useDisplayFont = true,
10453
10449
  ...props
10454
10450
  }, reference) => {
10455
10451
  // Set the `checked` state to the value of `defaultChecked` if it is truthy,
@@ -10473,19 +10469,7 @@ const PromoCard = /*#__PURE__*/forwardRef(({
10473
10469
  // Set the icon to `'arrow'` if `href` is truthy and `type` is falsy, or
10474
10470
  // `'download'` if `download` is truthy. If neither condition is true, set
10475
10471
  // `icon` to `undefined`.
10476
- // Create a function to get icon type
10477
- const getIconType = () => {
10478
- if (indicatorIcon) {
10479
- return indicatorIcon;
10480
- }
10481
- if (download) {
10482
- return 'download';
10483
- }
10484
- if (href && !type) {
10485
- return 'arrow';
10486
- }
10487
- return undefined;
10488
- };
10472
+ const icon = href && download ? 'download' : href ? 'arrow' : undefined;
10489
10473
  // Define all class names string based on the values of the `href`, `type`,
10490
10474
  // `checked`, and `className` props.
10491
10475
  const commonClasses = classNames({
@@ -10502,8 +10486,7 @@ const PromoCard = /*#__PURE__*/forwardRef(({
10502
10486
  isDisabled: isDisabled || contextIsDisabled,
10503
10487
  onClick,
10504
10488
  ref: reference,
10505
- 'data-testid': testId,
10506
- isSmall
10489
+ 'data-testid': testId
10507
10490
  };
10508
10491
  // Object with Anchor props that will be passed to the `a` element. These
10509
10492
  // won't be refurned if set to `isDisabled`
@@ -10531,27 +10514,6 @@ const PromoCard = /*#__PURE__*/forwardRef(({
10531
10514
  ref: reference,
10532
10515
  tabIndex: 0
10533
10516
  } : {};
10534
- const getTitle = () => {
10535
- const titleContent = href && !type ? /*#__PURE__*/jsx("a", {
10536
- className: "np-Card-titleLink",
10537
- ...anchorProps,
10538
- children: title
10539
- }) : title;
10540
- const titleProps = {
10541
- id: `${componentId}-title`,
10542
- as: headingLevel,
10543
- className: 'np-Card-title'
10544
- };
10545
- return useDisplayFont ? /*#__PURE__*/jsx(Display, {
10546
- type: Typography.DISPLAY_SMALL,
10547
- ...titleProps,
10548
- children: titleContent
10549
- }) : /*#__PURE__*/jsx(Title, {
10550
- type: Typography.TITLE_SUBSECTION,
10551
- ...titleProps,
10552
- children: titleContent
10553
- });
10554
- };
10555
10517
  useEffect(() => {
10556
10518
  setChecked(defaultChecked ?? isChecked ?? false);
10557
10519
  }, [defaultChecked, isChecked]);
@@ -10565,7 +10527,17 @@ const PromoCard = /*#__PURE__*/forwardRef(({
10565
10527
  size: 24,
10566
10528
  "aria-hidden": "true"
10567
10529
  })
10568
- }), getTitle(), /*#__PURE__*/jsx(Body, {
10530
+ }), /*#__PURE__*/jsx(Display, {
10531
+ id: `${componentId}-title`,
10532
+ as: headingLevel,
10533
+ className: "np-Card-title",
10534
+ type: Typography.DISPLAY_SMALL,
10535
+ children: href && !type ? /*#__PURE__*/jsx("a", {
10536
+ className: "np-Card-titleLink",
10537
+ ...anchorProps,
10538
+ children: title
10539
+ }) : title
10540
+ }), /*#__PURE__*/jsx(Body, {
10569
10541
  className: "np-Card-description",
10570
10542
  children: description
10571
10543
  }), imageSource && /*#__PURE__*/jsx("div", {
@@ -10579,8 +10551,7 @@ const PromoCard = /*#__PURE__*/forwardRef(({
10579
10551
  })
10580
10552
  }), /*#__PURE__*/jsx(PromoCardIndicator, {
10581
10553
  label: indicatorLabel,
10582
- icon: getIconType(),
10583
- isSmall: isSmall
10554
+ icon: icon
10584
10555
  })]
10585
10556
  });
10586
10557
  });