@transferwise/components 0.0.0-experimental-e95c8a5 → 0.0.0-experimental-39ab3ec

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 (90) hide show
  1. package/build/index.esm.js +65 -688
  2. package/build/index.esm.js.map +1 -1
  3. package/build/index.js +65 -691
  4. package/build/index.js.map +1 -1
  5. package/build/main.css +1 -1
  6. package/build/styles/common/closeButton/CloseButton.css +1 -1
  7. package/build/styles/inputs/Input.css +1 -1
  8. package/build/styles/inputs/InputGroup.css +1 -1
  9. package/build/styles/inputs/TextArea.css +1 -1
  10. package/build/styles/main.css +1 -1
  11. package/build/styles/promoCard/PromoCard.css +1 -1
  12. package/build/types/common/card/index.d.ts +1 -0
  13. package/build/types/common/card/index.d.ts.map +1 -1
  14. package/build/types/dateLookup/dateTrigger/DateTrigger.messages.d.ts +7 -7
  15. package/build/types/dateLookup/dateTrigger/DateTrigger.messages.d.ts.map +1 -1
  16. package/build/types/index.d.ts +0 -4
  17. package/build/types/index.d.ts.map +1 -1
  18. package/build/types/inputs/Input.d.ts +0 -1
  19. package/build/types/inputs/Input.d.ts.map +1 -1
  20. package/build/types/inputs/_common.d.ts.map +1 -1
  21. package/build/types/promoCard/PromoCard.d.ts +9 -3
  22. package/build/types/promoCard/PromoCard.d.ts.map +1 -1
  23. package/build/types/promoCard/PromoCardIndicator.d.ts +5 -3
  24. package/build/types/promoCard/PromoCardIndicator.d.ts.map +1 -1
  25. package/package.json +22 -28
  26. package/src/avatar/Avatar.story.tsx +16 -14
  27. package/src/common/card/Card.tsx +1 -1
  28. package/src/common/card/index.ts +1 -0
  29. package/src/common/closeButton/CloseButton.css +1 -1
  30. package/src/index.ts +0 -8
  31. package/src/inputs/Input.css +1 -1
  32. package/src/inputs/Input.less +0 -14
  33. package/src/inputs/Input.tsx +2 -6
  34. package/src/inputs/InputGroup.css +1 -1
  35. package/src/inputs/InputGroup.less +0 -5
  36. package/src/inputs/TextArea.css +1 -1
  37. package/src/inputs/TextArea.less +0 -5
  38. package/src/inputs/_common.less +4 -0
  39. package/src/inputs/_common.ts +1 -0
  40. package/src/main.css +1 -1
  41. package/src/main.less +0 -4
  42. package/src/navigationOption/NavigationOption.story.js +3 -5
  43. package/src/promoCard/PromoCard.css +1 -1
  44. package/src/promoCard/PromoCard.less +9 -9
  45. package/src/promoCard/PromoCard.spec.tsx +1 -0
  46. package/src/promoCard/PromoCard.story.tsx +86 -29
  47. package/src/promoCard/PromoCard.tsx +69 -22
  48. package/src/promoCard/PromoCardIndicator.tsx +20 -8
  49. package/src/radio/Radio.story.js +3 -2
  50. package/src/radioGroup/RadioGroup.story.js +2 -1
  51. package/src/select/searchBox/__snapshots__/SearchBox.spec.js.snap +1 -1
  52. package/src/ssr.spec.js +0 -7
  53. package/build/styles/inputs/SelectInput.css +0 -1
  54. package/build/types/common/hooks/useMedia.d.ts +0 -2
  55. package/build/types/common/hooks/useMedia.d.ts.map +0 -1
  56. package/build/types/common/hooks/useScreenSize.d.ts +0 -3
  57. package/build/types/common/hooks/useScreenSize.d.ts.map +0 -1
  58. package/build/types/common/preventScroll/PreventScroll.d.ts +0 -2
  59. package/build/types/common/preventScroll/PreventScroll.d.ts.map +0 -1
  60. package/build/types/inputs/SearchInput.d.ts +0 -10
  61. package/build/types/inputs/SearchInput.d.ts.map +0 -1
  62. package/build/types/inputs/SelectInput.d.ts +0 -41
  63. package/build/types/inputs/SelectInput.d.ts.map +0 -1
  64. package/build/types/inputs/_BottomSheet.d.ts +0 -17
  65. package/build/types/inputs/_BottomSheet.d.ts.map +0 -1
  66. package/build/types/inputs/_ButtonInput.d.ts +0 -6
  67. package/build/types/inputs/_ButtonInput.d.ts.map +0 -1
  68. package/build/types/inputs/_Popover.d.ts +0 -18
  69. package/build/types/inputs/_Popover.d.ts.map +0 -1
  70. package/build/types/utilities/wrapInFragment.d.ts +0 -3
  71. package/build/types/utilities/wrapInFragment.d.ts.map +0 -1
  72. package/src/common/hooks/useMedia.spec.ts +0 -39
  73. package/src/common/hooks/useMedia.ts +0 -15
  74. package/src/common/hooks/useScreenSize.ts +0 -7
  75. package/src/common/preventScroll/PreventScroll.tsx +0 -6
  76. package/src/inputs/SearchInput.story.tsx +0 -40
  77. package/src/inputs/SearchInput.tsx +0 -35
  78. package/src/inputs/SelectInput.css +0 -1
  79. package/src/inputs/SelectInput.less +0 -183
  80. package/src/inputs/SelectInput.spec.tsx +0 -120
  81. package/src/inputs/SelectInput.story.tsx +0 -259
  82. package/src/inputs/SelectInput.tsx +0 -565
  83. package/src/inputs/_BottomSheet.less +0 -107
  84. package/src/inputs/_BottomSheet.tsx +0 -128
  85. package/src/inputs/_ButtonInput.less +0 -7
  86. package/src/inputs/_ButtonInput.tsx +0 -27
  87. package/src/inputs/_Popover.less +0 -38
  88. package/src/inputs/_Popover.tsx +0 -118
  89. package/src/utilities/wrapInFragment.tsx +0 -3
  90. /package/src/dateLookup/dateTrigger/{DateTrigger.messages.ts → DateTrigger.messages.js} +0 -0
package/src/main.less CHANGED
@@ -30,12 +30,8 @@
30
30
  @import "./header/Header.less";
31
31
  @import "./image/Image.less";
32
32
  @import "./info/Info.less";
33
- @import "./inputs/_BottomSheet.less";
34
- @import "./inputs/_ButtonInput.less";
35
- @import "./inputs/_Popover.less";
36
33
  @import "./inputs/Input.less";
37
34
  @import "./inputs/InputGroup.less";
38
- @import "./inputs/SelectInput.less";
39
35
  @import "./inputs/TextArea.less";
40
36
  @import "./instructionsList/InstructionsList.less";
41
37
  @import "./link/Link.less";
@@ -7,7 +7,7 @@ import {
7
7
  Profile,
8
8
  UpwardGraph as UpwardGraphIcon,
9
9
  } from '@transferwise/icons';
10
- import { Illustration, Assets } from '@wise/art';
10
+ import { Illustration, Assets, Flag } from '@wise/art';
11
11
 
12
12
  import { Badge, Nudge, Avatar, Header } from '..';
13
13
 
@@ -203,7 +203,7 @@ export const BalanceContent = () => (
203
203
  showMediaCircle={false}
204
204
  media={
205
205
  <Avatar type="icon">
206
- <img src="https://wise.com/web-art/assets/flags/gbp.svg" alt="" />
206
+ <Flag code="GBP" />
207
207
  </Avatar>
208
208
  }
209
209
  />
@@ -229,9 +229,7 @@ export const ExistingContactContent = () => (
229
229
  content="EUR account ending in 1111"
230
230
  showMediaCircle={false}
231
231
  media={
232
- <Badge
233
- badge={<img src="https://wise.com/public-resources/assets/flags/square/eur.svg" alt="" />}
234
- >
232
+ <Badge badge={<Flag code="EUR" />}>
235
233
  <Avatar type="initials" size="md">
236
234
  <span aria-hidden>WS</span>
237
235
  </Avatar>
@@ -1 +1 @@
1
- .np-Card{--Card-image-scale:1;--Card-image-translate:0;--Card-indicator-text-background-color:var(--color-background-neutral);--Card-indicator-icon-background-color:var(--color-interactive-accent);--Card-indicator-icon-color:var(--color-interactive-control);--Card-check-background-color:var(--color-interactive-primary);--Card-check-color:var(--color-interactive-control)}.np-Card--promoCard{--Card-max-width:358px}.np-Card--promoCard.is-disabled{filter:grayscale(1);opacity:.45}.np-Card-image{height:auto;left:-24px;left:calc(var(--size-24)*-1);margin:0 auto;position:relative;transform:scale(var(--Card-image-scale)) translateY(var(--Card-image-translate));transition:transform .5s ease-in-out;width:100%;width:calc(100% + 48px);width:calc(100% + var(--size-48))}[dir=rtl] .np-Card-image{left:auto;right:-24px;right:calc(var(--size-24)*-1)}.np-Card-indicator{bottom:8px;bottom:var(--size-8);display:flex;gap:4px;gap:var(--size-4);position:absolute;right:8px;right:var(--size-8)}[dir=rtl] .np-Card-indicator{left:8px;left:var(--size-8);right:auto}.np-Card-indicatorText{background:var(--Card-indicator-text-background-color);border-radius:100px;display:inline-block;padding:16px;padding:var(--size-16);text-align:left;vertical-align:middle}.np-Card-indicatorIcon{align-items:center;background:var(--Card-indicator-icon-background-color);border-radius:9999px;border-radius:var(--radius-full);color:var(--Card-indicator-icon-color);display:inline-block;display:flex;height:56px;height:var(--size-56);justify-content:center;width:56px;width:var(--size-56)}[dir=rtl] .np-Card-indicatorIcon{transform:scaleX(-1)}.np-Card--checked,.np-Card--link{box-shadow:none;color:currentColor;cursor:pointer;transform:scale(1);transition:box-shadow .2s ease-in-out,transform .5s ease-in-out}.np-theme-personal:not(.np-theme-personal--dark,.np-theme-personal--bright-green,.np-theme-personal--forest-green) .np-Card--checked,.np-theme-personal:not(.np-theme-personal--dark,.np-theme-personal--bright-green,.np-theme-personal--forest-green) .np-Card--link{--Card-box-shadow:0px 20px var(--size-40) 0px var(--color-background-neutral);--Card-check-color:var(--color-interactive-accent)}.np-Card--checked.is-disabled,.np-Card--link.is-disabled{cursor:not-allowed}@media (prefers-reduced-motion:reduce){.np-Card--checked,.np-Card--link{transition:none}}.np-Card--checked:hover:not(.is-disabled,:disabled,.is-checked,:focus-within),.np-Card--link:hover:not(.is-disabled,:disabled,.is-checked,:focus-within){--Card-image-scale:1.1;box-shadow:var(--Card-box-shadow)}.np-Card--checked:active:not(.is-disabled,:disabled,.is-checked),.np-Card--link:active:not(.is-disabled,:disabled,.is-checked){--Card-background-color:var(--color-background-neutral-active);--Card-image-scale:1.1;--Card-image-translate:var(--size-8);box-shadow:var(--Card-box-shadow);transform:scale(98%)}.np-theme-personal--bright-green .np-Card--checked:active:not(.is-disabled,:disabled,.is-checked),.np-theme-personal--bright-green .np-Card--link:active:not(.is-disabled,:disabled,.is-checked){--Card-background-color:var(--color-background-neutral)}.np-Card--checked:focus-visible:not(.is-disabled,:disabled),.np-Card--checked:has(:focus-visible):not(.np-Card--checked),.np-Card--link:focus-visible:not(.is-disabled,:disabled),.np-Card--link:has(:focus-visible):not(.np-Card--checked){--Card-image-scale:1.1;box-shadow:var(--Card-box-shadow);outline:var(--ring-outline-color) solid 4px;outline:var(--ring-outline-color) solid var(--size-4);outline-offset:4px;outline-offset:var(--size-4)}.np-Card--link .np-Card-titleLink{color:#37517e;color:var(--color-content-primary);text-decoration:none}.np-Card--link .np-Card-titleLink:focus-visible{outline:none}.np-Card--link .np-Card-titleLink:after{content:"";display:block;height:100%;left:0;position:absolute;top:0;width:100%;z-index:10}.np-Card--checked.is-checked{box-shadow:0 0 0 4px var(--color-interactive-primary);box-shadow:0 0 0 var(--size-4) var(--color-interactive-primary)}.np-Card--checked.is-checked .np-Card-check{align-items:center;background:var(--Card-check-background-color);border-radius:9999px;border-radius:var(--radius-full);color:var(--Card-check-color);display:flex;height:40px;height:var(--size-40);justify-content:center;position:absolute;right:8px;right:var(--size-8);top:8px;top:var(--size-8);width:40px;width:var(--size-40)}[dir=rtl] .np-Card--checked.is-checked .np-Card-check{left:8px;left:var(--size-8);right:auto}.np-Card--checked.is-checked:focus-visible:not(.is-disabled,:disabled){box-shadow:none}.np-CardGroup{display:flex;flex-direction:column;gap:24px;gap:var(--size-24);width:100%}@media (min-width:768px){.np-CardGroup{flex-direction:row}}.np-CardGroup .np-Card.np-Card--promoCard{max-width:100%}
1
+ .np-Card{--Card-image-scale:1;--Card-image-translate:0;--Card-indicator-text-background-color:var(--color-background-neutral);--Card-indicator-icon-background-color:var(--color-interactive-accent);--Card-indicator-icon-color:var(--color-interactive-control);--Card-check-background-color:var(--color-interactive-primary);--Card-check-color:var(--color-interactive-control)}.np-Card--promoCard{--Card-max-width:358px}.np-Card--promoCard.is-disabled{filter:grayscale(1);opacity:.45}.np-Card-image{height:auto;left:-24px;left:calc(var(--size-24)*-1);margin:0 auto;position:relative;transform:scale(var(--Card-image-scale)) translateY(var(--Card-image-translate));transition:transform .5s ease-in-out;width:100%;width:calc(100% + 48px);width:calc(100% + var(--size-48))}[dir=rtl] .np-Card-image{left:auto;right:-24px;right:calc(var(--size-24)*-1)}.np-Card-description{color:#5d7079;color:var(--color-content-secondary)}.np-Card-indicator{bottom:8px;bottom:var(--size-8);display:flex;gap:4px;gap:var(--size-4);position:absolute;right:8px;right:var(--size-8)}[dir=rtl] .np-Card-indicator{left:8px;left:var(--size-8);right:auto}.np-Card-indicatorText{background:var(--Card-indicator-text-background-color);border-radius:100px;display:inline-block;padding:16px;padding:var(--size-16);text-align:left;vertical-align:middle}.np-Card-indicatorIcon .tw-icon{color:var(--Card-indicator-icon-color)}[dir=rtl] .np-Card-indicatorIcon .tw-icon{transform:scaleX(-1)}.np-Card--checked,.np-Card--link{box-shadow:none;color:currentColor;cursor:pointer;transform:scale(1);transition:box-shadow .2s ease-in-out,transform .5s ease-in-out}.np-theme-personal:not(.np-theme-personal--dark,.np-theme-personal--bright-green,.np-theme-personal--forest-green) .np-Card--checked,.np-theme-personal:not(.np-theme-personal--dark,.np-theme-personal--bright-green,.np-theme-personal--forest-green) .np-Card--link{--Card-box-shadow:0px 20px var(--size-40) 0px var(--color-background-neutral);--Card-check-color:var(--color-interactive-accent)}.np-Card--checked.is-disabled,.np-Card--link.is-disabled{cursor:not-allowed}@media (prefers-reduced-motion:reduce){.np-Card--checked,.np-Card--link{transition:none}}.np-Card--checked:hover:not(.is-disabled,:disabled,.is-checked,:focus-within),.np-Card--link:hover:not(.is-disabled,:disabled,.is-checked,:focus-within){--Card-image-scale:1.1;box-shadow:var(--Card-box-shadow)}.np-Card--checked:active:not(.is-disabled,:disabled,.is-checked),.np-Card--link:active:not(.is-disabled,:disabled,.is-checked){--Card-background-color:var(--color-background-neutral-active);--Card-image-scale:1.1;--Card-image-translate:var(--size-8);box-shadow:var(--Card-box-shadow);transform:scale(98%)}.np-theme-personal--bright-green .np-Card--checked:active:not(.is-disabled,:disabled,.is-checked),.np-theme-personal--bright-green .np-Card--link:active:not(.is-disabled,:disabled,.is-checked){--Card-background-color:var(--color-background-neutral)}.np-Card--checked:focus-visible:not(.is-disabled,:disabled),.np-Card--checked:has(:focus-visible):not(.np-Card--checked),.np-Card--link:focus-visible:not(.is-disabled,:disabled),.np-Card--link:has(:focus-visible):not(.np-Card--checked){--Card-image-scale:1.1;box-shadow:var(--Card-box-shadow);outline:var(--ring-outline-color) solid 4px;outline:var(--ring-outline-color) solid var(--size-4);outline-offset:4px;outline-offset:var(--size-4)}.np-Card--checked:has(.np-Card-closeButton:focus-visible),.np-Card--link:has(.np-Card-closeButton:focus-visible){outline:none}.np-Card--link .np-Card-titleLink{color:#37517e;color:var(--color-content-primary);text-decoration:none}.np-Card--link .np-Card-titleLink:focus-visible{outline:none}.np-Card--link .np-Card-titleLink:after{content:"";display:block;height:100%;left:0;position:absolute;top:0;width:100%;z-index:10}.np-Card--checked.is-checked{box-shadow:0 0 0 4px var(--color-interactive-primary);box-shadow:0 0 0 var(--size-4) var(--color-interactive-primary)}.np-Card--checked.is-checked .np-Card-check{align-items:center;background:var(--Card-check-background-color);border-radius:50%;border-radius:var(--radius-full);color:var(--Card-check-color);display:flex;height:40px;height:var(--size-40);justify-content:center;position:absolute;right:8px;right:var(--size-8);top:8px;top:var(--size-8);width:40px;width:var(--size-40)}[dir=rtl] .np-Card--checked.is-checked .np-Card-check{left:8px;left:var(--size-8);right:auto}.np-Card--checked.is-checked:focus-visible:not(.is-disabled,:disabled){box-shadow:none}.np-CardGroup{display:flex;flex-direction:column;gap:24px;gap:var(--size-24);width:100%}@media (min-width:768px){.np-CardGroup{flex-direction:row}}.np-CardGroup .np-Card.np-Card--promoCard{max-width:100%}
@@ -32,6 +32,10 @@
32
32
  right: calc(var(--size-24) * -1);
33
33
  }
34
34
  }
35
+
36
+ &-description {
37
+ color: var(--color-content-secondary);
38
+ }
35
39
 
36
40
  &-indicator {
37
41
  position: absolute;
@@ -54,16 +58,8 @@
54
58
  border-radius: 100px;
55
59
  }
56
60
 
57
- &Icon {
61
+ &Icon .tw-icon {
58
62
  color: var(--Card-indicator-icon-color);
59
- width: var(--size-56);
60
- height: var(--size-56);
61
- display: inline-block;
62
- background: var(--Card-indicator-icon-background-color);
63
- border-radius: var(--radius-full);
64
- display: flex;
65
- justify-content: center;
66
- align-items: center;
67
63
 
68
64
  // Flips icon for right to left content
69
65
  [dir="rtl"] & {
@@ -123,6 +119,10 @@
123
119
  outline-offset: var(--size-4);
124
120
  box-shadow: var(--Card-box-shadow);
125
121
  }
122
+
123
+ &:has(.np-Card-closeButton:focus-visible) {
124
+ outline: none;
125
+ }
126
126
  }
127
127
 
128
128
  &--link {
@@ -11,6 +11,7 @@ describe('PromoCard', () => {
11
11
  description: 'Test Description',
12
12
  indicatorLabel: 'Test Indicator Label',
13
13
  testId: 'test-promo-card',
14
+ children: 'Test Content',
14
15
  };
15
16
 
16
17
  let rerenderPromoCard: (props?: PromoCardProps) => void;
@@ -1,11 +1,15 @@
1
1
  import { Meta, StoryObj } from '@storybook/react';
2
+ import { StarFill } from '@transferwise/icons';
2
3
 
3
- import PromoCard from './PromoCard';
4
+ import PromoCard, { PromoCardCheckedProps, PromoCardLinkProps } from './PromoCard';
4
5
 
5
6
  const meta: Meta<typeof PromoCard> = {
6
7
  component: PromoCard,
7
8
  title: 'Layouts/PromoCard',
8
9
  tags: ['autodocs'],
10
+ parameters: {
11
+ actions: { argTypesRegex: null },
12
+ },
9
13
  };
10
14
 
11
15
  export default meta;
@@ -22,54 +26,107 @@ export const Default: Story = {
22
26
 
23
27
  export const Link: Story = {
24
28
  args: {
25
- description: 'A card that lives online and works anywhere. Easy, secure, and always on hand.',
26
- title: 'Digital',
29
+ ...Default.args,
27
30
  href: 'https://wise.com',
28
- indicatorLabel: 'Free',
29
- imageSource: 'https://wise.com/web-art/assets/illustrations/digital-card-2-medium@2x.webp',
30
- },
31
+ } as PromoCardLinkProps,
32
+ };
33
+
34
+ export const TaskCard: Story = {
35
+ args: {
36
+ ...Link.args,
37
+ title: 'Add money for when you need it',
38
+ description: 'Get ready to send and spend.',
39
+ indicatorLabel: undefined,
40
+ imageSource: undefined,
41
+ onDismiss: () => {
42
+ alert('Dismissed!');
43
+ },
44
+ isSmall: true,
45
+ useDisplayFont: false,
46
+ className: 'taskCard',
47
+ } as PromoCardLinkProps,
48
+ decorators: [
49
+ (Story) => (
50
+ <div>
51
+ <style>
52
+ {`
53
+ .storybook-container {
54
+ background-color: var(--color-background-neutral);
55
+ }
56
+
57
+ .taskCard {
58
+ background-color: var(--color-background-screen);
59
+ position: relative;
60
+ width: 208px;
61
+ height: 268px;
62
+ }
63
+
64
+ .taskCard .np-Card-title {
65
+ margin-top: var(--size-24);
66
+ }
67
+
68
+
69
+ .taskCard.np-Card--link:hover:not(.is-disabled, :disabled, :focus-within) {
70
+ box-shadow: none;
71
+ background-color: var(--color-background-screen-hover);
72
+ }
73
+
74
+ .taskCard.np-Card--link:active:not(.is-disabled, :disabled) {
75
+ box-shadow: none;
76
+ background-color: var(--color-background-screen-hover);
77
+ }
78
+ `}
79
+ </style>
80
+ <Story />
81
+ </div>
82
+ ),
83
+ ],
84
+ };
85
+
86
+ export const TaskCardWithCustomIcon: Story = {
87
+ args: {
88
+ ...TaskCard.args,
89
+ indicatorIcon: <StarFill size={24} aria-hidden="true" />,
90
+ } as PromoCardLinkProps,
91
+ decorators: TaskCard.decorators,
92
+ };
93
+
94
+ export const TaskCardCompleted: Story = {
95
+ args: {
96
+ ...TaskCard.args,
97
+ onDismiss: undefined,
98
+ href: undefined,
99
+ indicatorIcon: 'check',
100
+ className: 'taskCard taskCard--completed np-theme--personal np-theme-personal--forest-green',
101
+ } as PromoCardLinkProps,
102
+ decorators: TaskCard.decorators,
31
103
  };
32
104
 
33
105
  export const Check: Story = {
34
106
  args: {
35
- description: 'A card that lives online and works anywhere. Easy, secure, and always on hand.',
36
- title: 'Digital',
107
+ ...Default.args,
37
108
  type: 'checkbox',
38
- indicatorLabel: 'Free',
39
- imageSource: 'https://wise.com/web-art/assets/illustrations/digital-card-2-medium@2x.webp',
40
- },
109
+ } as PromoCardCheckedProps,
41
110
  };
42
111
 
43
112
  export const DefaultChecked: Story = {
44
113
  args: {
45
- description: 'A card that lives online and works anywhere. Easy, secure, and always on hand.',
46
- title: 'Digital',
47
- type: 'checkbox',
48
- indicatorLabel: 'Free',
114
+ ...Check.args,
49
115
  defaultChecked: true,
50
- imageSource: 'https://wise.com/web-art/assets/illustrations/digital-card-2-medium@2x.webp',
51
- },
116
+ } as PromoCardCheckedProps,
52
117
  };
53
118
 
54
119
  export const Disabled: Story = {
55
120
  args: {
56
- description: 'A card that lives online and works anywhere. Easy, secure, and always on hand.',
57
- title: 'Digital',
58
- type: 'checkbox',
121
+ ...Check.args,
59
122
  isDisabled: true,
60
- indicatorLabel: 'Free',
61
- imageSource: 'https://wise.com/web-art/assets/illustrations/digital-card-2-medium@2x.webp',
62
123
  },
63
124
  };
64
125
 
65
126
  export const CustomClass: Story = {
66
127
  args: {
67
- description: 'A card that lives online and works anywhere. Easy, secure, and always on hand.',
68
- title: 'Digital',
69
- href: 'https://wise.com',
128
+ ...Link.args,
70
129
  className: 'np-CustomPromoCard',
71
- indicatorLabel: 'Free',
72
- imageSource: 'https://wise.com/web-art/assets/illustrations/digital-card-medium@2x.webp',
73
130
  },
74
131
  decorators: [
75
132
  (Story) => (
@@ -78,8 +135,8 @@ export const CustomClass: Story = {
78
135
  {`
79
136
  .np-CustomPromoCard {
80
137
  --Card-background-color: var(--color-bright-yellow);
81
- --Card-indicator-icon-background-color: var(--color-dark-gold);
82
- --Card-indicator-icon-color: var(--color-contrast);
138
+ --Card-indicator-icon-background-color: var(--color-background-neutral);
139
+ --color-interactive-control: var(--color-primary);
83
140
  }
84
141
  `}
85
142
  </style>
@@ -1,15 +1,16 @@
1
1
  import { Check } from '@transferwise/icons';
2
2
  import classNames from 'classnames';
3
- import React, { forwardRef, FunctionComponent, useState, useEffect, useMemo } from 'react';
3
+ import React, { forwardRef, FunctionComponent, ReactElement, useEffect, useState } from 'react';
4
4
 
5
5
  import Body from '../body';
6
6
  import { Typography } from '../common';
7
- import Card from '../common/card';
7
+ import Card, { CardProps } from '../common/card';
8
8
  import Display from '../display';
9
9
  import Image from '../image/Image';
10
+ import Title from '../title';
10
11
 
11
12
  import { usePromoCardContext } from './PromoCardContext';
12
- import PromoCardIndicator from './PromoCardIndicator';
13
+ import PromoCardIndicator, { PromoCardIndicatorProps } from './PromoCardIndicator';
13
14
 
14
15
  export type ReferenceType = React.Ref<HTMLInputElement>;
15
16
  export type LinkTarget = '_blank' | '_parent' | '_self' | '_top';
@@ -49,6 +50,9 @@ export interface PromoCardCommonProps {
49
50
  /** Optional prop to specify text for the indicator label of the PromoCard */
50
51
  indicatorLabel?: string;
51
52
 
53
+ /** Optional prop to specify the icon for the indicator icon of the PromoCard */
54
+ indicatorIcon?: PromoCardIndicatorProps['icon'];
55
+
52
56
  /** Optional prop to specify an image alt text */
53
57
  imageAlt?: string;
54
58
 
@@ -56,7 +60,7 @@ export interface PromoCardCommonProps {
56
60
  imageClass?: string;
57
61
 
58
62
  /** Optional prop to specify an image source url */
59
- imageSource: string;
63
+ imageSource?: string;
60
64
 
61
65
  /** Specify whether the PromoCard is disabled, or not */
62
66
  isDisabled?: boolean;
@@ -69,9 +73,12 @@ export interface PromoCardCommonProps {
69
73
 
70
74
  /** Required prop to specify the title text of the PromoCard */
71
75
  title: string;
76
+
77
+ /** Set to false to use body font style for the title */
78
+ useDisplayFont?: boolean;
72
79
  }
73
80
 
74
- export interface PromoCardLinkProps extends PromoCardCommonProps {
81
+ export interface PromoCardLinkProps extends PromoCardCommonProps, Omit<CardProps, 'children'> {
75
82
  /**
76
83
  * Optional prop to prompts a user to save the linked URL instead of
77
84
  * navigating to it
@@ -102,7 +109,7 @@ export interface PromoCardLinkProps extends PromoCardCommonProps {
102
109
  value?: never;
103
110
  }
104
111
 
105
- export interface PromoCardCheckedProps extends PromoCardCommonProps {
112
+ export interface PromoCardCheckedProps extends PromoCardCommonProps, Omit<CardProps, 'children'> {
106
113
  /** Specify the initial checked attribute of the PromoCard */
107
114
  defaultChecked?: boolean;
108
115
 
@@ -206,6 +213,7 @@ const PromoCard: FunctionComponent<PromoCardProps> = forwardRef(
206
213
  imageClass,
207
214
  imageSource,
208
215
  indicatorLabel,
216
+ indicatorIcon,
209
217
  isChecked,
210
218
  isDisabled,
211
219
  onClick,
@@ -216,6 +224,8 @@ const PromoCard: FunctionComponent<PromoCardProps> = forwardRef(
216
224
  title,
217
225
  type,
218
226
  value,
227
+ isSmall,
228
+ useDisplayFont = true,
219
229
  ...props
220
230
  },
221
231
  reference,
@@ -241,7 +251,25 @@ const PromoCard: FunctionComponent<PromoCardProps> = forwardRef(
241
251
  // Set the icon to `'arrow'` if `href` is truthy and `type` is falsy, or
242
252
  // `'download'` if `download` is truthy. If neither condition is true, set
243
253
  // `icon` to `undefined`.
244
- const icon = href && download ? 'download' : href ? 'arrow' : undefined;
254
+
255
+ // Create a function to get icon type
256
+ const getIconType = () => {
257
+ if (indicatorIcon) {
258
+ return indicatorIcon;
259
+ }
260
+
261
+ if (download) {
262
+ return 'download';
263
+ }
264
+
265
+ if (href && !type) {
266
+ return 'arrow';
267
+ }
268
+
269
+ return undefined;
270
+ };
271
+
272
+ const CardTitle = useDisplayFont ? Display : Title;
245
273
 
246
274
  // Define all class names string based on the values of the `href`, `type`,
247
275
  // `checked`, and `className` props.
@@ -261,6 +289,7 @@ const PromoCard: FunctionComponent<PromoCardProps> = forwardRef(
261
289
  onClick,
262
290
  ref: reference,
263
291
  'data-testid': testId,
292
+ isSmall,
264
293
  };
265
294
 
266
295
  // Object with Anchor props that will be passed to the `a` element. These
@@ -298,6 +327,33 @@ const PromoCard: FunctionComponent<PromoCardProps> = forwardRef(
298
327
  }
299
328
  : {};
300
329
 
330
+ const getTitle = () => {
331
+ const titleContent =
332
+ href && !type ? (
333
+ <a className="np-Card-titleLink" {...anchorProps}>
334
+ {title}
335
+ </a>
336
+ ) : (
337
+ title
338
+ );
339
+
340
+ const titleProps = {
341
+ id: `${componentId}-title`,
342
+ as: headingLevel,
343
+ className: 'np-Card-title',
344
+ };
345
+
346
+ return useDisplayFont ? (
347
+ <Display type={Typography.DISPLAY_SMALL} {...titleProps}>
348
+ {titleContent}
349
+ </Display>
350
+ ) : (
351
+ <Title type={Typography.TITLE_SUBSECTION} {...titleProps}>
352
+ {titleContent}
353
+ </Title>
354
+ );
355
+ };
356
+
301
357
  useEffect(() => {
302
358
  setChecked(defaultChecked ?? isChecked ?? false);
303
359
  }, [defaultChecked, isChecked]);
@@ -309,27 +365,18 @@ const PromoCard: FunctionComponent<PromoCardProps> = forwardRef(
309
365
  <Check size={24} aria-hidden="true" />
310
366
  </span>
311
367
  )}
312
- <Display
313
- id={`${componentId}-title`}
314
- as={headingLevel}
315
- className="np-Card-title"
316
- type={Typography.DISPLAY_SMALL}
317
- >
318
- {href && !type ? (
319
- <a className="np-Card-titleLink" {...anchorProps}>
320
- {title}
321
- </a>
322
- ) : (
323
- title
324
- )}
325
- </Display>
368
+
369
+ {getTitle()}
370
+
326
371
  <Body className="np-Card-description">{description}</Body>
372
+
327
373
  {imageSource && (
328
374
  <div className={classNames('np-Card-image', { imageClass })}>
329
375
  <Image src={imageSource} alt={imageAlt || ''} loading="lazy" />
330
376
  </div>
331
377
  )}
332
- <PromoCardIndicator label={indicatorLabel} icon={icon} />
378
+
379
+ <PromoCardIndicator label={indicatorLabel} icon={getIconType()} isSmall={isSmall} />
333
380
  </Card>
334
381
  );
335
382
  },
@@ -1,7 +1,8 @@
1
1
  import { ArrowRight, Check, Download } from '@transferwise/icons';
2
2
  import classNames from 'classnames';
3
- import { ReactNode } from 'react';
3
+ import { ReactElement, ReactNode } from 'react';
4
4
 
5
+ import Avatar, { AvatarType } from '../avatar';
5
6
  import Body from '../body';
6
7
  import { Typography } from '../common';
7
8
 
@@ -13,7 +14,10 @@ export type PromoCardIndicatorProps = {
13
14
  label?: string;
14
15
 
15
16
  /** Optional icon to display in the indicator. */
16
- icon?: 'check' | 'arrow' | 'download';
17
+ icon?: 'check' | 'arrow' | 'download' | ReactElement;
18
+
19
+ /** Optional prop to specify whether the indicator is sized small or not. */
20
+ isSmall?: boolean;
17
21
 
18
22
  /** Optional ID to add to the indicator container for testing purposes. */
19
23
  testid?: string;
@@ -31,7 +35,7 @@ export type PromoCardIndicatorProps = {
31
35
  *
32
36
  * @param {string} className - Optional class name(s) to add to the indicator container.
33
37
  * @param {string} label - Optional label to display next to the indicator.
34
- * @param {string} icon - Optional icon to display in the indicator.
38
+ * @param {string | ReactElement} icon - Optional icon to display in the indicator.
35
39
  * @param {string} testid - Optional ID to add to the indicator container for testing purposes.
36
40
  * @param {ReactNode} children - Optional children to display inside the indicator.
37
41
  * @returns {JSX.Element} - The PromoCardIndicator component.
@@ -43,11 +47,14 @@ const PromoCardIndicator: React.FC<PromoCardIndicatorProps> = ({
43
47
  children,
44
48
  label,
45
49
  icon,
50
+ isSmall = false,
46
51
  testid,
47
52
  ...rest
48
53
  }) => {
54
+ const isIconString = icon && typeof icon === 'string';
55
+
49
56
  const IconComponent =
50
- icon &&
57
+ isIconString &&
51
58
  {
52
59
  check: Check,
53
60
  arrow: ArrowRight,
@@ -61,10 +68,15 @@ const PromoCardIndicator: React.FC<PromoCardIndicatorProps> = ({
61
68
  {label}
62
69
  </Body>
63
70
  )}
64
- {IconComponent && (
65
- <span className="np-Card-indicatorIcon">
66
- <IconComponent size={24} aria-hidden="true" />
67
- </span>
71
+ {icon && (
72
+ <Avatar
73
+ type={AvatarType.ICON}
74
+ size={isSmall ? 40 : 56}
75
+ backgroundColor="var(--Card-indicator-icon-background-color)"
76
+ className="np-Card-indicatorIcon"
77
+ >
78
+ {IconComponent ? <IconComponent size={24} aria-hidden="true" /> : icon}
79
+ </Avatar>
68
80
  )}
69
81
  {children}
70
82
  </div>
@@ -1,5 +1,6 @@
1
1
  import { boolean, text } from '@storybook/addon-knobs';
2
2
  import { Check } from '@transferwise/icons';
3
+ import { Flag } from '@wise/art';
3
4
  import { useState } from 'react';
4
5
 
5
6
  import Avatar, { AvatarType } from '../avatar';
@@ -33,7 +34,7 @@ export const Basic = () => {
33
34
  avatar={
34
35
  showAvatar ? (
35
36
  <Avatar type={AvatarType.THUMBNAIL}>
36
- <img src="https://wise.com/web-art/assets/flags/imp.svg" alt="" />
37
+ <Flag code="IMP" />
37
38
  </Avatar>
38
39
  ) : null
39
40
  }
@@ -51,7 +52,7 @@ export const Basic = () => {
51
52
  avatar={
52
53
  showAvatar ? (
53
54
  <Avatar type={AvatarType.THUMBNAIL}>
54
- <img src="https://wise.com/web-art/assets/flags/kes.svg" alt="" />
55
+ <Flag code="KES" />
55
56
  </Avatar>
56
57
  ) : null
57
58
  }
@@ -1,5 +1,6 @@
1
1
  import { action } from '@storybook/addon-actions';
2
2
  import { boolean } from '@storybook/addon-knobs';
3
+ import { Flag } from '@wise/art';
3
4
 
4
5
  import Avatar, { AvatarType } from '../avatar';
5
6
 
@@ -16,7 +17,7 @@ export const Basic = () => {
16
17
 
17
18
  const avatar = showAvatars ? (
18
19
  <Avatar type={AvatarType.THUMBNAIL}>
19
- <img src="https://wise.com/web-art/assets/flags/nzd.svg" alt="" />
20
+ <Flag code="NZD" />
20
21
  </Avatar>
21
22
  ) : undefined;
22
23
 
@@ -34,7 +34,7 @@ exports[`SearchBox renders 1`] = `
34
34
  </span>
35
35
  </span>
36
36
  <input
37
- class="np-select-filter form-control np-form-control np-form-control--size-auto np-text-body-large np-input np-input--shape-rectangle"
37
+ class="np-select-filter form-control np-form-control np-form-control--size-auto np-text-body-large np-form-control--shape-rectangle"
38
38
  placeholder="placeholder"
39
39
  spellcheck="false"
40
40
  value="value"
package/src/ssr.spec.js CHANGED
@@ -48,10 +48,6 @@ const excluded = new Set([
48
48
  'Typography',
49
49
 
50
50
  // types
51
- 'SearchInputProps',
52
- 'SelectInputItem',
53
- 'SelectInputOptionContentProps',
54
- 'SelectInputProps',
55
51
  'UploadedFile',
56
52
  'UploadError',
57
53
  'UploadResponse',
@@ -183,9 +179,6 @@ describe('Server side rendering', () => {
183
179
  Input: {
184
180
  children: undefined,
185
181
  },
186
- SearchInput: {
187
- children: undefined,
188
- },
189
182
  TextArea: {
190
183
  children: undefined,
191
184
  },
@@ -1 +0,0 @@
1
- .np-select-input-placeholder{color:#768e9c;color:var(--color-content-tertiary);overflow:hidden;text-overflow:ellipsis;white-space:nowrap}.np-select-input-options-container{display:flex;flex-direction:column;height:100%}.np-select-input-options-container:focus{outline:none}@media (min-width:576px){.np-select-input-options-container{max-height:28rem}}.np-select-input-query-container{display:flex;flex-direction:column;padding:8px;padding:var(--size-8);padding-top:0}@media (min-width:576px){.np-select-input-query-container{padding-top:8px;padding-top:var(--size-8)}}.np-select-input-listbox-container{height:var(--initial-height);overflow-y:auto;position:relative;scroll-padding-bottom:8px;scroll-padding-bottom:var(--size-8);scroll-padding-top:8px;scroll-padding-top:var(--size-8)}@media (min-width:576px){.np-select-input-listbox-container{height:auto}}.np-select-input-listbox-container--has-group{scroll-padding-top:32px;scroll-padding-top:var(--size-32)}.np-select-input-listbox{padding:8px;padding:var(--size-8)}.np-select-input-listbox:focus{outline:none}.np-select-input-separator-item{border-top-width:1px;margin:8px;margin:var(--size-8)}.np-select-input-group-item--without-needle:first-child{margin-top:-8px;margin-top:calc(var(--size-8)*-1)}.np-select-input-group-item-header{background-color:#fff;background-color:var(--color-background-elevated);color:#5d7079;color:var(--color-content-secondary);padding:8px 16px 4px;padding:var(--size-8) var(--size-16) var(--size-4);position:sticky;top:0;z-index:10}.np-select-input-option-container{align-items:center;border-radius:10px;border-radius:var(--radius-small);color:#37517e;color:var(--color-content-primary);-moz-column-gap:8px;column-gap:8px;-moz-column-gap:var(--size-8);column-gap:var(--size-8);display:flex;padding:12px 16px;padding:var(--size-12) var(--size-16)}.np-select-input-option-container--active{background-color:var(--color-background-screen-hover)}.np-select-input-option-container--disabled{opacity:.45}.np-select-input-option-check--not-selected{visibility:hidden}.np-select-input-option{flex:1}.np-select-input-option-content-container{align-items:center;color:#37517e;color:var(--color-content-primary);-moz-column-gap:8px;column-gap:8px;-moz-column-gap:var(--size-8);column-gap:var(--size-8);display:flex}.np-select-input-option-content-icon{display:flex}.np-select-input-option-content-icon--not-compact{align-self:flex-start}.np-select-input-option-content-text{display:flex;flex:1;flex-direction:column;overflow:hidden}.np-select-input-option-content-text-secondary{color:#5d7079;color:var(--color-content-secondary)}.np-select-input-option-content-text-compact{overflow:hidden;text-overflow:ellipsis;white-space:nowrap}.np-select-input-option-content-text-line-1>:not([hidden])~:not([hidden]){margin-left:8px;margin-left:var(--size-8);margin-right:8px;margin-right:var(--size-8)}.np-select-input-addon-container{align-items:center;display:inline-flex;pointer-events:none}.np-select-input-addon{align-items:center;background:none;border-radius:.125rem;border-width:0;display:inline-flex;height:32px;height:var(--size-32);justify-content:center;width:32px;width:var(--size-32)}.np-select-input-addon--interactive{color:#c9cbce;color:var(--color-interactive-secondary);pointer-events:auto}.np-select-input-addon--interactive:hover{color:#b5b7ba;color:var(--color-interactive-secondary-hover)}.np-select-input-addon--interactive:focus{outline:none}.np-select-input-addon--interactive:focus-visible{outline:var(--ring-outline-color) solid var(--ring-outline-width);outline-offset:var(--ring-outline-offset)}.np-select-input-addon-separator{border-inline-start-width:1px;height:24px;height:var(--size-24)}
@@ -1,2 +0,0 @@
1
- export declare function useMedia(query: string): boolean | undefined;
2
- //# sourceMappingURL=useMedia.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"useMedia.d.ts","sourceRoot":"","sources":["../../../../src/common/hooks/useMedia.ts"],"names":[],"mappings":"AAEA,wBAAgB,QAAQ,CAAC,KAAK,EAAE,MAAM,uBAYrC"}
@@ -1,3 +0,0 @@
1
- import { Breakpoint } from '../propsValues/breakpoint';
2
- export declare function useScreenSize(size: Breakpoint): boolean | undefined;
3
- //# sourceMappingURL=useScreenSize.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"useScreenSize.d.ts","sourceRoot":"","sources":["../../../../src/common/hooks/useScreenSize.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,2BAA2B,CAAC;AAIvD,wBAAgB,aAAa,CAAC,IAAI,EAAE,UAAU,uBAE7C"}
@@ -1,2 +0,0 @@
1
- export declare function PreventScroll(): null;
2
- //# sourceMappingURL=PreventScroll.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"PreventScroll.d.ts","sourceRoot":"","sources":["../../../../src/common/preventScroll/PreventScroll.tsx"],"names":[],"mappings":"AAEA,wBAAgB,aAAa,SAG5B"}
@@ -1,10 +0,0 @@
1
- /// <reference types="react" />
2
- import { Merge } from '../utils';
3
- export interface SearchInputProps extends Merge<React.ComponentPropsWithRef<'input'>, {
4
- size?: 'sm' | 'md';
5
- shape?: 'rectangle' | 'pill';
6
- 'aria-invalid'?: boolean;
7
- }> {
8
- }
9
- export declare const SearchInput: import("react").ForwardRefExoticComponent<Omit<SearchInputProps, "ref"> & import("react").RefAttributes<HTMLInputElement>>;
10
- //# sourceMappingURL=SearchInput.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"SearchInput.d.ts","sourceRoot":"","sources":["../../../src/inputs/SearchInput.tsx"],"names":[],"mappings":";AAGA,OAAO,EAAE,KAAK,EAAE,MAAM,UAAU,CAAC;AAKjC,MAAM,WAAW,gBACf,SAAQ,KAAK,CACX,KAAK,CAAC,qBAAqB,CAAC,OAAO,CAAC,EACpC;IACE,IAAI,CAAC,EAAE,IAAI,GAAG,IAAI,CAAC;IACnB,KAAK,CAAC,EAAE,WAAW,GAAG,MAAM,CAAC;IAC7B,cAAc,CAAC,EAAE,OAAO,CAAC;CAC1B,CACF;CAAG;AAEN,eAAO,MAAM,WAAW,4HAgBtB,CAAC"}