@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
package/build/index.js CHANGED
@@ -644,10 +644,8 @@ const Option$2 = /*#__PURE__*/React.forwardRef(({
644
644
  })
645
645
  }), /*#__PURE__*/jsxRuntime.jsxs("div", {
646
646
  className: "media-body",
647
- children: [/*#__PURE__*/jsxRuntime.jsx(Body, {
648
- as: "span",
649
- type: exports.Typography.BODY_LARGE_BOLD,
650
- className: "text-primary np-option__title d-block",
647
+ children: [/*#__PURE__*/jsxRuntime.jsx("h4", {
648
+ className: "np-text-body-large-bold text-primary np-option__title",
651
649
  children: title
652
650
  }), content && /*#__PURE__*/jsxRuntime.jsx(Body, {
653
651
  className: "d-block np-option__body",
@@ -2366,7 +2364,7 @@ var Card$2 = Card$1;
2366
2364
 
2367
2365
  const Card = ({
2368
2366
  className,
2369
- children = null,
2367
+ children,
2370
2368
  id,
2371
2369
  isDisabled = false,
2372
2370
  isSmall = false,
@@ -2389,10 +2387,7 @@ const Card = ({
2389
2387
  size: isSmall ? 'sm' : 'md',
2390
2388
  isDisabled: isDisabled,
2391
2389
  testId: "close-button",
2392
- onClick: e => {
2393
- stopPropagation$1(e);
2394
- onDismiss();
2395
- }
2390
+ onClick: onDismiss
2396
2391
  }), children]
2397
2392
  });
2398
2393
  };
@@ -2755,8 +2750,10 @@ const DateInput = ({
2755
2750
  size,
2756
2751
  value,
2757
2752
  dayLabel,
2753
+ dayAutoComplete,
2758
2754
  monthLabel,
2759
2755
  yearLabel,
2756
+ yearAutoComplete,
2760
2757
  monthFormat,
2761
2758
  mode,
2762
2759
  onChange,
@@ -2954,6 +2951,7 @@ const DateInput = ({
2954
2951
  children: /*#__PURE__*/jsxRuntime.jsx(Input, {
2955
2952
  type: "number",
2956
2953
  name: "day",
2954
+ autoComplete: dayAutoComplete,
2957
2955
  value: day || '',
2958
2956
  placeholder: placeholders.day,
2959
2957
  disabled: disabled,
@@ -2976,6 +2974,7 @@ const DateInput = ({
2976
2974
  children: /*#__PURE__*/jsxRuntime.jsx(Input, {
2977
2975
  type: "number",
2978
2976
  name: "year",
2977
+ autoComplete: yearAutoComplete,
2979
2978
  placeholder: placeholders.year,
2980
2979
  value: year || '',
2981
2980
  disabled: disabled,
@@ -3023,8 +3022,10 @@ DateInput.propTypes = {
3023
3022
  onFocus: PropTypes__default.default.func,
3024
3023
  onBlur: PropTypes__default.default.func,
3025
3024
  dayLabel: PropTypes__default.default.string,
3025
+ dayAutoComplete: PropTypes__default.default.string,
3026
3026
  monthLabel: PropTypes__default.default.string,
3027
3027
  yearLabel: PropTypes__default.default.string,
3028
+ yearAutoComplete: PropTypes__default.default.string,
3028
3029
  monthFormat: PropTypes__default.default.oneOf(['long', 'short']),
3029
3030
  mode: PropTypes__default.default.oneOf(['day-month-year', 'month-year']),
3030
3031
  placeholders: PropTypes__default.default.shape({
@@ -3041,6 +3042,8 @@ DateInput.defaultProps = {
3041
3042
  value: null,
3042
3043
  onFocus: null,
3043
3044
  onBlur: null,
3045
+ dayAutoComplete: null,
3046
+ yearAutoComplete: null,
3044
3047
  monthFormat: exports.MonthFormat.LONG,
3045
3048
  mode: exports.DateMode.DAY_MONTH_YEAR,
3046
3049
  id: '',
@@ -10130,6 +10133,7 @@ const PhoneNumberInput = props => {
10130
10133
  className: `input-group input-group-${size}`,
10131
10134
  children: /*#__PURE__*/jsxRuntime.jsx("input", {
10132
10135
  id: id,
10136
+ autoComplete: "tel-national",
10133
10137
  name: "phoneNumber",
10134
10138
  inputMode: "numeric",
10135
10139
  value: internalValue.suffix,
@@ -10381,12 +10385,10 @@ const PromoCardIndicator = ({
10381
10385
  children,
10382
10386
  label,
10383
10387
  icon,
10384
- isSmall = false,
10385
10388
  testid,
10386
10389
  ...rest
10387
10390
  }) => {
10388
- const isIconString = icon && typeof icon === 'string';
10389
- const IconComponent = isIconString && {
10391
+ const IconComponent = icon && {
10390
10392
  check: icons.Check,
10391
10393
  arrow: icons.ArrowRight,
10392
10394
  download: icons.Download
@@ -10400,15 +10402,12 @@ const PromoCardIndicator = ({
10400
10402
  type: exports.Typography.BODY_LARGE_BOLD,
10401
10403
  className: "np-Card-indicatorText",
10402
10404
  children: label
10403
- }), icon && /*#__PURE__*/jsxRuntime.jsx(Avatar, {
10404
- type: exports.AvatarType.ICON,
10405
- size: isSmall ? 40 : 56,
10406
- backgroundColor: "var(--Card-indicator-icon-background-color)",
10405
+ }), IconComponent && /*#__PURE__*/jsxRuntime.jsx("span", {
10407
10406
  className: "np-Card-indicatorIcon",
10408
- children: IconComponent ? /*#__PURE__*/jsxRuntime.jsx(IconComponent, {
10407
+ children: /*#__PURE__*/jsxRuntime.jsx(IconComponent, {
10409
10408
  size: 24,
10410
10409
  "aria-hidden": "true"
10411
- }) : icon
10410
+ })
10412
10411
  }), children]
10413
10412
  });
10414
10413
  };
@@ -10470,7 +10469,6 @@ const PromoCard = /*#__PURE__*/React.forwardRef(({
10470
10469
  imageClass,
10471
10470
  imageSource,
10472
10471
  indicatorLabel,
10473
- indicatorIcon,
10474
10472
  isChecked,
10475
10473
  isDisabled,
10476
10474
  onClick,
@@ -10481,8 +10479,6 @@ const PromoCard = /*#__PURE__*/React.forwardRef(({
10481
10479
  title,
10482
10480
  type,
10483
10481
  value,
10484
- isSmall,
10485
- useDisplayFont = true,
10486
10482
  ...props
10487
10483
  }, reference) => {
10488
10484
  // Set the `checked` state to the value of `defaultChecked` if it is truthy,
@@ -10506,19 +10502,7 @@ const PromoCard = /*#__PURE__*/React.forwardRef(({
10506
10502
  // Set the icon to `'arrow'` if `href` is truthy and `type` is falsy, or
10507
10503
  // `'download'` if `download` is truthy. If neither condition is true, set
10508
10504
  // `icon` to `undefined`.
10509
- // Create a function to get icon type
10510
- const getIconType = () => {
10511
- if (indicatorIcon) {
10512
- return indicatorIcon;
10513
- }
10514
- if (download) {
10515
- return 'download';
10516
- }
10517
- if (href && !type) {
10518
- return 'arrow';
10519
- }
10520
- return undefined;
10521
- };
10505
+ const icon = href && download ? 'download' : href ? 'arrow' : undefined;
10522
10506
  // Define all class names string based on the values of the `href`, `type`,
10523
10507
  // `checked`, and `className` props.
10524
10508
  const commonClasses = classNames__default.default({
@@ -10535,8 +10519,7 @@ const PromoCard = /*#__PURE__*/React.forwardRef(({
10535
10519
  isDisabled: isDisabled || contextIsDisabled,
10536
10520
  onClick,
10537
10521
  ref: reference,
10538
- 'data-testid': testId,
10539
- isSmall
10522
+ 'data-testid': testId
10540
10523
  };
10541
10524
  // Object with Anchor props that will be passed to the `a` element. These
10542
10525
  // won't be refurned if set to `isDisabled`
@@ -10564,27 +10547,6 @@ const PromoCard = /*#__PURE__*/React.forwardRef(({
10564
10547
  ref: reference,
10565
10548
  tabIndex: 0
10566
10549
  } : {};
10567
- const getTitle = () => {
10568
- const titleContent = href && !type ? /*#__PURE__*/jsxRuntime.jsx("a", {
10569
- className: "np-Card-titleLink",
10570
- ...anchorProps,
10571
- children: title
10572
- }) : title;
10573
- const titleProps = {
10574
- id: `${componentId}-title`,
10575
- as: headingLevel,
10576
- className: 'np-Card-title'
10577
- };
10578
- return useDisplayFont ? /*#__PURE__*/jsxRuntime.jsx(Display, {
10579
- type: exports.Typography.DISPLAY_SMALL,
10580
- ...titleProps,
10581
- children: titleContent
10582
- }) : /*#__PURE__*/jsxRuntime.jsx(Title, {
10583
- type: exports.Typography.TITLE_SUBSECTION,
10584
- ...titleProps,
10585
- children: titleContent
10586
- });
10587
- };
10588
10550
  React.useEffect(() => {
10589
10551
  setChecked(defaultChecked ?? isChecked ?? false);
10590
10552
  }, [defaultChecked, isChecked]);
@@ -10598,7 +10560,17 @@ const PromoCard = /*#__PURE__*/React.forwardRef(({
10598
10560
  size: 24,
10599
10561
  "aria-hidden": "true"
10600
10562
  })
10601
- }), getTitle(), /*#__PURE__*/jsxRuntime.jsx(Body, {
10563
+ }), /*#__PURE__*/jsxRuntime.jsx(Display, {
10564
+ id: `${componentId}-title`,
10565
+ as: headingLevel,
10566
+ className: "np-Card-title",
10567
+ type: exports.Typography.DISPLAY_SMALL,
10568
+ children: href && !type ? /*#__PURE__*/jsxRuntime.jsx("a", {
10569
+ className: "np-Card-titleLink",
10570
+ ...anchorProps,
10571
+ children: title
10572
+ }) : title
10573
+ }), /*#__PURE__*/jsxRuntime.jsx(Body, {
10602
10574
  className: "np-Card-description",
10603
10575
  children: description
10604
10576
  }), imageSource && /*#__PURE__*/jsxRuntime.jsx("div", {
@@ -10612,8 +10584,7 @@ const PromoCard = /*#__PURE__*/React.forwardRef(({
10612
10584
  })
10613
10585
  }), /*#__PURE__*/jsxRuntime.jsx(PromoCardIndicator, {
10614
10586
  label: indicatorLabel,
10615
- icon: getIconType(),
10616
- isSmall: isSmall
10587
+ icon: icon
10617
10588
  })]
10618
10589
  });
10619
10590
  });