@transferwise/components 45.14.2 → 45.15.1

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 (160) hide show
  1. package/build/i18n/en.json +8 -0
  2. package/build/index.esm.js +1001 -367
  3. package/build/index.esm.js.map +1 -1
  4. package/build/index.js +1003 -366
  5. package/build/index.js.map +1 -1
  6. package/build/main.css +1 -1
  7. package/build/styles/common/closeButton/CloseButton.css +1 -1
  8. package/build/styles/dateLookup/DateLookup.css +1 -1
  9. package/build/styles/inputs/Input.css +1 -1
  10. package/build/styles/inputs/InputGroup.css +1 -1
  11. package/build/styles/inputs/SelectInput.css +1 -0
  12. package/build/styles/inputs/TextArea.css +1 -1
  13. package/build/styles/main.css +1 -1
  14. package/build/styles/promoCard/PromoCard.css +1 -1
  15. package/build/styles/stepper/Stepper.css +1 -1
  16. package/build/types/avatarWrapper/AvatarWrapper.d.ts +14 -5
  17. package/build/types/avatarWrapper/AvatarWrapper.d.ts.map +1 -1
  18. package/build/types/common/Option/Option.d.ts.map +1 -1
  19. package/build/types/common/focusBoundary/FocusBoundary.d.ts +2 -2
  20. package/build/types/common/focusBoundary/FocusBoundary.d.ts.map +1 -1
  21. package/build/types/common/hooks/useMedia.d.ts +2 -0
  22. package/build/types/common/hooks/useMedia.d.ts.map +1 -0
  23. package/build/types/common/hooks/useScreenSize.d.ts +3 -0
  24. package/build/types/common/hooks/useScreenSize.d.ts.map +1 -0
  25. package/build/types/common/preventScroll/PreventScroll.d.ts +2 -0
  26. package/build/types/common/preventScroll/PreventScroll.d.ts.map +1 -0
  27. package/build/types/dateInput/DateInput.d.ts +2 -0
  28. package/build/types/dateInput/DateInput.d.ts.map +1 -1
  29. package/build/types/dateLookup/DateLookup.messages.d.ts +65 -0
  30. package/build/types/dateLookup/DateLookup.messages.d.ts.map +1 -0
  31. package/build/types/dateLookup/dateHeader/DateHeader.d.ts +3 -1
  32. package/build/types/dateLookup/dateHeader/DateHeader.d.ts.map +1 -1
  33. package/build/types/dateLookup/dateTrigger/DateTrigger.messages.d.ts +7 -7
  34. package/build/types/dateLookup/dateTrigger/DateTrigger.messages.d.ts.map +1 -1
  35. package/build/types/dateLookup/tableLink/TableLink.d.ts +4 -26
  36. package/build/types/dateLookup/tableLink/TableLink.d.ts.map +1 -1
  37. package/build/types/dateLookup/yearCalendar/YearCalendar.d.ts +4 -29
  38. package/build/types/dateLookup/yearCalendar/YearCalendar.d.ts.map +1 -1
  39. package/build/types/index.d.ts +4 -0
  40. package/build/types/index.d.ts.map +1 -1
  41. package/build/types/inputs/Input.d.ts +1 -0
  42. package/build/types/inputs/Input.d.ts.map +1 -1
  43. package/build/types/inputs/SearchInput.d.ts +10 -0
  44. package/build/types/inputs/SearchInput.d.ts.map +1 -0
  45. package/build/types/inputs/SelectInput.d.ts +41 -0
  46. package/build/types/inputs/SelectInput.d.ts.map +1 -0
  47. package/build/types/inputs/_BottomSheet.d.ts +17 -0
  48. package/build/types/inputs/_BottomSheet.d.ts.map +1 -0
  49. package/build/types/inputs/_ButtonInput.d.ts +6 -0
  50. package/build/types/inputs/_ButtonInput.d.ts.map +1 -0
  51. package/build/types/inputs/_Popover.d.ts +18 -0
  52. package/build/types/inputs/_Popover.d.ts.map +1 -0
  53. package/build/types/inputs/_common.d.ts.map +1 -1
  54. package/build/types/logo/Logo.d.ts.map +1 -1
  55. package/build/types/phoneNumberInput/PhoneNumberInput.d.ts.map +1 -1
  56. package/build/types/snackbar/Snackbar.d.ts.map +1 -1
  57. package/build/types/stepper/Stepper.d.ts.map +1 -1
  58. package/build/types/tabs/Tabs.d.ts.map +1 -1
  59. package/build/types/tile/Tile.d.ts.map +1 -1
  60. package/build/types/upload/steps/completeStep/completeStep.d.ts.map +1 -1
  61. package/build/types/upload/steps/processingStep/processingStep.d.ts.map +1 -1
  62. package/build/types/utilities/wrapInFragment.d.ts +3 -0
  63. package/build/types/utilities/wrapInFragment.d.ts.map +1 -0
  64. package/package.json +27 -20
  65. package/src/accordion/AccordionItem/__snapshots__/AccordionItem.spec.js.snap +6 -6
  66. package/src/avatarWrapper/AvatarWrapper.tsx +20 -8
  67. package/src/avatarWrapper/__snapshots__/AvatarWrapper.spec.tsx.snap +1 -1
  68. package/src/card/Card.spec.js +2 -2
  69. package/src/common/Option/Option.tsx +1 -7
  70. package/src/common/bottomSheet/__snapshots__/BottomSheet.spec.tsx.snap +8 -1
  71. package/src/common/closeButton/CloseButton.css +1 -1
  72. package/src/common/focusBoundary/FocusBoundary.tsx +9 -32
  73. package/src/common/hooks/useMedia.spec.ts +39 -0
  74. package/src/common/hooks/useMedia.ts +15 -0
  75. package/src/common/hooks/useScreenSize.ts +7 -0
  76. package/src/common/preventScroll/PreventScroll.tsx +6 -0
  77. package/src/dateInput/DateInput.js +6 -0
  78. package/src/dateInput/DateInput.story.tsx +2 -0
  79. package/src/dateLookup/DateLookup.css +1 -1
  80. package/src/dateLookup/DateLookup.keyboardEvents.spec.js +3 -3
  81. package/src/dateLookup/DateLookup.less +4 -0
  82. package/src/dateLookup/DateLookup.messages.js +44 -0
  83. package/src/dateLookup/DateLookup.testingLibrary.spec.js +39 -0
  84. package/src/dateLookup/dateHeader/DateHeader.js +48 -26
  85. package/src/dateLookup/dateHeader/DateHeader.spec.js +37 -0
  86. package/src/dateLookup/dayCalendar/DayCalendar.js +3 -1
  87. package/src/dateLookup/dayCalendar/DayCalendar.spec.js +7 -1
  88. package/src/dateLookup/dayCalendar/table/DayCalendarTable.js +7 -3
  89. package/src/dateLookup/dayCalendar/table/DayCalendarTable.spec.js +1 -0
  90. package/src/dateLookup/monthCalendar/MonthCalendar.js +3 -1
  91. package/src/dateLookup/monthCalendar/MonthCalendar.spec.js +7 -1
  92. package/src/dateLookup/monthCalendar/table/MonthCalendarTable.spec.js +4 -5
  93. package/src/dateLookup/tableLink/TableLink.js +24 -3
  94. package/src/dateLookup/tableLink/TableLink.spec.js +60 -4
  95. package/src/dateLookup/yearCalendar/YearCalendar.js +16 -3
  96. package/src/dateLookup/yearCalendar/YearCalendar.spec.js +14 -1
  97. package/src/dateLookup/yearCalendar/table/YearCalendarTable.spec.js +4 -5
  98. package/src/decision/Decision.story.js +11 -11
  99. package/src/flowNavigation/__snapshots__/FlowNavigation.spec.js.snap +12 -12
  100. package/src/i18n/en.json +9 -0
  101. package/src/index.ts +8 -0
  102. package/src/inputs/Input.css +1 -1
  103. package/src/inputs/Input.less +14 -0
  104. package/src/inputs/Input.tsx +6 -2
  105. package/src/inputs/InputGroup.css +1 -1
  106. package/src/inputs/InputGroup.less +5 -0
  107. package/src/inputs/SearchInput.story.tsx +40 -0
  108. package/src/inputs/SearchInput.tsx +35 -0
  109. package/src/inputs/SelectInput.css +1 -0
  110. package/src/inputs/SelectInput.less +183 -0
  111. package/src/inputs/SelectInput.spec.tsx +120 -0
  112. package/src/inputs/SelectInput.story.tsx +264 -0
  113. package/src/inputs/SelectInput.tsx +565 -0
  114. package/src/inputs/TextArea.css +1 -1
  115. package/src/inputs/TextArea.less +5 -0
  116. package/src/inputs/_BottomSheet.less +107 -0
  117. package/src/inputs/_BottomSheet.tsx +128 -0
  118. package/src/inputs/_ButtonInput.less +7 -0
  119. package/src/inputs/_ButtonInput.tsx +27 -0
  120. package/src/inputs/_Popover.less +38 -0
  121. package/src/inputs/_Popover.tsx +118 -0
  122. package/src/inputs/_common.less +0 -4
  123. package/src/inputs/_common.ts +0 -1
  124. package/src/logo/Logo.js +3 -21
  125. package/src/logo/__snapshots__/Logo.spec.js.snap +78 -30
  126. package/src/main.css +1 -1
  127. package/src/main.less +4 -0
  128. package/src/phoneNumberInput/PhoneNumberInput.js +1 -0
  129. package/src/promoCard/PromoCard.css +1 -1
  130. package/src/select/searchBox/__snapshots__/SearchBox.spec.js.snap +1 -1
  131. package/src/snackbar/Snackbar.js +6 -1
  132. package/src/snackbar/Snackbar.spec.js +1 -3
  133. package/src/ssr.spec.js +7 -0
  134. package/src/stepper/Stepper.css +1 -1
  135. package/src/stepper/Stepper.less +1 -9
  136. package/src/stepper/Stepper.spec.js +4 -4
  137. package/src/stepper/Stepper.tsx +2 -5
  138. package/src/tabs/Tabs.js +2 -1
  139. package/src/tile/Tile.js +5 -11
  140. package/src/tile/__snapshots__/Tile.spec.js.snap +7 -9
  141. package/src/upload/Upload.js +1 -1
  142. package/src/upload/steps/completeStep/completeStep.js +4 -1
  143. package/src/upload/steps/processingStep/processingStep.js +1 -0
  144. package/src/uploadInput/uploadItem/UploadItem.tsx +1 -1
  145. package/src/utilities/wrapInFragment.tsx +3 -0
  146. package/build/types/common/focusBoundary/utils/getFocusableElements.d.ts +0 -2
  147. package/build/types/common/focusBoundary/utils/getFocusableElements.d.ts.map +0 -1
  148. package/build/types/common/focusBoundary/utils/index.d.ts +0 -3
  149. package/build/types/common/focusBoundary/utils/index.d.ts.map +0 -1
  150. package/build/types/common/focusBoundary/utils/resetFocus.d.ts +0 -2
  151. package/build/types/common/focusBoundary/utils/resetFocus.d.ts.map +0 -1
  152. package/src/common/focusBoundary/FocusBoundary.spec.tsx +0 -66
  153. package/src/common/focusBoundary/__snapshots__/FocusBoundary.spec.tsx.snap +0 -16
  154. package/src/common/focusBoundary/utils/getFocusableElements.js +0 -25
  155. package/src/common/focusBoundary/utils/getFocusableElements.spec.js +0 -51
  156. package/src/common/focusBoundary/utils/index.js +0 -2
  157. package/src/common/focusBoundary/utils/resetFocus.js +0 -23
  158. package/src/common/focusBoundary/utils/resetFocus.spec.js +0 -103
  159. package/src/snackbar/__snapshots__/Snackbar.spec.js.snap +0 -5
  160. /package/src/dateLookup/dateTrigger/{DateTrigger.messages.js → DateTrigger.messages.ts} +0 -0
@@ -0,0 +1,128 @@
1
+ import {
2
+ FloatingFocusManager,
3
+ FloatingPortal,
4
+ useDismiss,
5
+ useFloating,
6
+ useInteractions,
7
+ useRole,
8
+ } from '@floating-ui/react';
9
+ import { Transition } from '@headlessui/react';
10
+ import classNames from 'classnames';
11
+ import { useState } from 'react';
12
+
13
+ import { CloseButton } from '../common/closeButton';
14
+ import { PreventScroll } from '../common/preventScroll/PreventScroll';
15
+ import { Size } from '../common/propsValues/size';
16
+
17
+ export interface BottomSheetProps {
18
+ open: boolean;
19
+ renderTrigger?: (args: {
20
+ ref: React.RefCallback<Element>;
21
+ getInteractionProps: (customEventHandlers?: React.HTMLProps<Element>) => {
22
+ [key: string]: unknown;
23
+ };
24
+ }) => React.ReactNode;
25
+ title?: string;
26
+ initialFocusRef?: React.RefObject<HTMLElement>;
27
+ padding?: 'none' | 'md';
28
+ children?: React.ReactNode;
29
+ onClose?: () => void;
30
+ }
31
+
32
+ export function BottomSheet({
33
+ open,
34
+ renderTrigger,
35
+ title,
36
+ initialFocusRef,
37
+ padding = 'md',
38
+ children,
39
+ onClose,
40
+ }: BottomSheetProps) {
41
+ const { refs, context } = useFloating<Element>({
42
+ open,
43
+ onOpenChange: (value) => {
44
+ if (!value) {
45
+ onClose?.();
46
+ }
47
+ },
48
+ });
49
+
50
+ const dismiss = useDismiss(context, {
51
+ outsidePressEvent: 'mousedown',
52
+ });
53
+ const role = useRole(context);
54
+ const { getReferenceProps, getFloatingProps } = useInteractions([dismiss, role]);
55
+
56
+ const [floatingKey, setFloatingKey] = useState(0);
57
+
58
+ return (
59
+ <>
60
+ {open ? <PreventScroll /> : null}
61
+ {renderTrigger?.({
62
+ ref: refs.setReference,
63
+ getInteractionProps: getReferenceProps,
64
+ })}
65
+
66
+ <FloatingPortal>
67
+ <Transition
68
+ show={open}
69
+ className="np-bottom-sheet-v2-container"
70
+ beforeEnter={() => {
71
+ setFloatingKey((prev) => prev + 1);
72
+ }}
73
+ >
74
+ <Transition.Child
75
+ enter="np-bottom-sheet-v2-backdrop-container--enter"
76
+ enterFrom="np-bottom-sheet-v2-backdrop-container--enter-from"
77
+ leave="np-bottom-sheet-v2-backdrop-container--leave"
78
+ leaveTo="np-bottom-sheet-v2-backdrop-container--leave-to"
79
+ >
80
+ <div className="np-bottom-sheet-v2-backdrop" />
81
+ </Transition.Child>
82
+
83
+ <FloatingFocusManager context={context} initialFocus={initialFocusRef}>
84
+ <div className="np-bottom-sheet-v2">
85
+ <Transition.Child
86
+ className="np-bottom-sheet-v2-content"
87
+ enter="np-bottom-sheet-v2-content--enter"
88
+ enterFrom="np-bottom-sheet-v2-content--enter-from"
89
+ leave="np-bottom-sheet-v2-content--leave"
90
+ leaveTo="np-bottom-sheet-v2-content--leave-to"
91
+ >
92
+ <div
93
+ key={floatingKey} // Force inner state invalidation on open
94
+ ref={refs.setFloating}
95
+ className="np-bottom-sheet-v2-content-inner-container"
96
+ {...getFloatingProps()}
97
+ >
98
+ <div className="np-bottom-sheet-v2-header">
99
+ <CloseButton
100
+ size={Size.SMALL}
101
+ onClick={() => {
102
+ onClose?.();
103
+ }}
104
+ />
105
+ </div>
106
+ <div
107
+ className={classNames(
108
+ 'np-bottom-sheet-v2-content-inner',
109
+ title && 'np-bottom-sheet-v2-content-inner--has-title',
110
+ {
111
+ 'np-bottom-sheet-v2-content-inner--padding-md': padding === 'md',
112
+ },
113
+ )}
114
+ >
115
+ {title ? (
116
+ <h2 className="np-bottom-sheet-v2-title np-text-title-body">{title}</h2>
117
+ ) : null}
118
+ <div className="np-bottom-sheet-v2-body np-text-body-default">{children}</div>
119
+ </div>
120
+ </div>
121
+ </Transition.Child>
122
+ </div>
123
+ </FloatingFocusManager>
124
+ </Transition>
125
+ </FloatingPortal>
126
+ </>
127
+ );
128
+ }
@@ -0,0 +1,7 @@
1
+ .np-button-input {
2
+ display: inline-grid;
3
+ grid-auto-columns: minmax(0, 1fr);
4
+ align-content: center;
5
+ border-radius: var(--size-10);
6
+ text-align: start;
7
+ }
@@ -0,0 +1,27 @@
1
+ import classNames from 'classnames';
2
+ import { forwardRef } from 'react';
3
+
4
+ import { useInputPaddings } from './InputGroup';
5
+ import { formControlClassNameBase } from './_common';
6
+
7
+ export interface ButtonInputProps extends React.ComponentPropsWithRef<'button'> {
8
+ size?: 'sm' | 'md' | 'lg';
9
+ }
10
+
11
+ export const ButtonInput = forwardRef(function ButtonInput(
12
+ { size = 'md', className, style, ...restProps }: ButtonInputProps,
13
+ ref: React.ForwardedRef<HTMLButtonElement>,
14
+ ) {
15
+ const inputPaddings = useInputPaddings();
16
+
17
+ return (
18
+ <button
19
+ ref={ref}
20
+ type="button"
21
+ className={classNames(className, formControlClassNameBase({ size }), 'np-button-input')}
22
+ // eslint-disable-next-line react/forbid-dom-props
23
+ style={{ ...inputPaddings, ...style }}
24
+ {...restProps}
25
+ />
26
+ );
27
+ });
@@ -0,0 +1,38 @@
1
+ .np-popover-v2-container {
2
+ z-index: 10;
3
+ display: flex;
4
+ max-height: var(--max-height);
5
+ width: var(--width);
6
+ min-width: min-content;
7
+ flex-direction: column;
8
+ border-radius: var(--radius-small);
9
+ background-color: var(--color-background-elevated);
10
+ box-shadow: 0 0 40px rgb(69 71 69 / 0.2);
11
+
12
+ &:focus {
13
+ outline: none;
14
+ }
15
+ }
16
+
17
+ .np-popover-v2 {
18
+ display: grid;
19
+ row-gap: var(--size-8);
20
+ overflow-y: auto;
21
+ grid-template-rows: repeat(1, minmax(0, 1fr));
22
+
23
+ &--has-title {
24
+ grid-template-rows: auto 1fr;
25
+ }
26
+
27
+ &--padding-md {
28
+ padding: var(--size-16);
29
+ }
30
+ }
31
+
32
+ .np-popover-v2-title {
33
+ color: var(--color-content-primary);
34
+ }
35
+
36
+ .np-popover-v2-content {
37
+ color: var(--color-content-secondary);
38
+ }
@@ -0,0 +1,118 @@
1
+ import {
2
+ autoUpdate,
3
+ flip,
4
+ FloatingFocusManager,
5
+ FloatingPortal,
6
+ offset,
7
+ shift,
8
+ type Side,
9
+ size,
10
+ useDismiss,
11
+ useFloating,
12
+ useInteractions,
13
+ useRole,
14
+ } from '@floating-ui/react';
15
+ import { Transition } from '@headlessui/react';
16
+ import classNames from 'classnames';
17
+ import { useState } from 'react';
18
+
19
+ import { PreventScroll } from '../common/preventScroll/PreventScroll';
20
+
21
+ export interface PopoverProps {
22
+ placement?: Side;
23
+ open: boolean;
24
+ renderTrigger: (args: {
25
+ ref: React.RefCallback<Element>;
26
+ getInteractionProps: (customEventHandlers?: React.HTMLProps<Element>) => {
27
+ [key: string]: unknown;
28
+ };
29
+ }) => React.ReactNode;
30
+ title?: string;
31
+ padding?: 'none' | 'md';
32
+ children?: React.ReactNode;
33
+ onClose?: () => void;
34
+ }
35
+
36
+ const floatingPadding = 16;
37
+
38
+ export function Popover({
39
+ placement,
40
+ open,
41
+ renderTrigger,
42
+ title,
43
+ padding = 'md',
44
+ children,
45
+ onClose,
46
+ }: PopoverProps) {
47
+ const { refs, floatingStyles, context } = useFloating<Element>({
48
+ placement,
49
+ middleware: [
50
+ offset(8),
51
+ flip({ padding: floatingPadding, crossAxis: false }),
52
+ shift(),
53
+ size({
54
+ padding: floatingPadding,
55
+ apply: ({ elements, rects, availableHeight }) => {
56
+ elements.floating.style.setProperty('--max-height', `${availableHeight}px`);
57
+ elements.floating.style.setProperty('--width', `${rects.reference.width}px`);
58
+ },
59
+ }),
60
+ ],
61
+ whileElementsMounted: autoUpdate,
62
+ open,
63
+ onOpenChange: (value) => {
64
+ if (!value) {
65
+ onClose?.();
66
+ }
67
+ },
68
+ });
69
+
70
+ const dismiss = useDismiss(context, {
71
+ outsidePressEvent: 'mousedown',
72
+ });
73
+ const role = useRole(context);
74
+ const { getReferenceProps, getFloatingProps } = useInteractions([role, dismiss]);
75
+
76
+ const [floatingKey, setFloatingKey] = useState(0);
77
+
78
+ return (
79
+ <>
80
+ {open ? <PreventScroll /> : null}
81
+ {renderTrigger({
82
+ ref: refs.setReference,
83
+ getInteractionProps: getReferenceProps,
84
+ })}
85
+
86
+ <FloatingPortal>
87
+ <FloatingFocusManager context={context}>
88
+ <Transition
89
+ show={open}
90
+ leave="transition-opacity"
91
+ leaveTo="opacity-0"
92
+ beforeEnter={() => {
93
+ setFloatingKey((prev) => prev + 1);
94
+ }}
95
+ >
96
+ <div
97
+ key={floatingKey} // Force inner state invalidation on open
98
+ ref={refs.setFloating}
99
+ className="np-popover-v2-container"
100
+ // eslint-disable-next-line react/forbid-dom-props
101
+ style={floatingStyles}
102
+ {...getFloatingProps()}
103
+ >
104
+ <div
105
+ className={classNames('np-popover-v2', title && 'np-popover-v2--has-title', {
106
+ 'np-popover-v2--padding-md': padding === 'md',
107
+ })}
108
+ >
109
+ {title ? <h2 className="np-popover-v2-title np-text-title-body">{title}</h2> : null}
110
+ <div className="np-popover-v2-content np-text-body-default">{children}</div>
111
+ </div>
112
+ </div>
113
+ </Transition>
114
+ </FloatingFocusManager>
115
+ </FloatingPortal>
116
+ </>
117
+ );
118
+ }
@@ -56,8 +56,4 @@
56
56
  &--size-lg {
57
57
  height: var(--size-72) !important;
58
58
  }
59
-
60
- &--shape-rectangle {
61
- border-radius: var(--radius-small);
62
- }
63
59
  }
@@ -16,6 +16,5 @@ export function formControlClassNameBase({ size = 'auto' }: FormControlPropsBase
16
16
  'np-form-control--size-md np-text-body-large': size === 'md',
17
17
  'np-form-control--size-lg np-text-title-subsection': size === 'lg',
18
18
  },
19
- 'np-form-control--shape-rectangle',
20
19
  );
21
20
  }
package/src/logo/Logo.js CHANGED
@@ -1,4 +1,3 @@
1
- import { useTheme } from '@wise/components-theming';
2
1
  import classNames from 'classnames';
3
2
  import PropTypes from 'prop-types';
4
3
 
@@ -9,21 +8,9 @@ import { useClientWidth } from '../common/hooks';
9
8
  import { LogoType } from './logoTypes';
10
9
  import { LogoFlagInverse } from './svg/flag-inverse.svg';
11
10
  import { LogoFlag } from './svg/flag.svg';
12
- import { LogoWiseBusinessInverse } from './svg/logo-business-inverse.svg';
13
- import { LogoWiseBusiness } from './svg/logo-business.svg';
14
11
  import { LogoWiseInverse } from './svg/logo-inverse.svg';
15
12
  import { LogoWise } from './svg/logo.svg';
16
13
 
17
- const baseUrl = 'https://wise.com/public-resources/assets/logos/wise/';
18
-
19
- const logoPaths = {
20
- WISE: 'brand_logo.svg',
21
- WISE_BUSINESS: 'brand_logo_business.svg',
22
- WISE_INVERSE: 'brand_logo_inverse.svg',
23
- WISE_BUSINESS_INVERSE: 'brand_logo_business_inverse.svg',
24
- WISE_FLAG: 'brand_flag.svg',
25
- };
26
-
27
14
  const svgPaths = {
28
15
  WISE: LogoWise,
29
16
  WISE_BUSINESS: LogoWise,
@@ -34,21 +21,16 @@ const svgPaths = {
34
21
  };
35
22
 
36
23
  const Logo = ({ className, inverse, type }) => {
37
- const { isModern } = useTheme();
38
24
  const [clientWidth] = useClientWidth({ ref: isServerSide() ? undefined : window });
39
25
  const isSmall = clientWidth < Breakpoint.SMALL;
40
- const path = isSmall ? logoPaths['WISE_FLAG'] : logoPaths[`${type}${inverse ? '_INVERSE' : ''}`];
41
26
  const LogoSvg = isSmall
42
27
  ? svgPaths[`WISE_FLAG${inverse ? '_INVERSE' : ''}`]
43
28
  : svgPaths[`${type}${inverse ? '_INVERSE' : ''}`];
44
29
 
45
- return isModern ? (
46
- <LogoSvg className="np-logo-svg" />
47
- ) : (
48
- <img
49
- className={classNames('np-logo', className)}
30
+ return (
31
+ <LogoSvg
32
+ className={classNames('np-logo-svg', className)}
50
33
  alt={type === LogoType.WISE ? 'Wise' : 'Wise business'}
51
- src={`${baseUrl}${path}`}
52
34
  />
53
35
  );
54
36
  };
@@ -1,61 +1,109 @@
1
1
  // Jest Snapshot v1, https://goo.gl/fbAQLP
2
2
 
3
+ exports[`Logo on mobile renders only fast flag 1`] = `
4
+ <div>
5
+ <svg
6
+ alt="Wise"
7
+ class="np-logo-svg class"
8
+ fill="none"
9
+ height="24"
10
+ width="26"
11
+ xmlns="http://www.w3.org/2000/svg"
12
+ >
13
+ <path
14
+ d="M6.826 7.232 0 15.21h12.188l1.37-3.762H8.335l3.191-3.69.01-.098L9.461 4.09h9.336L11.56 24h4.953L25.25 0H2.676l4.15 7.232Z"
15
+ fill="#163300"
16
+ />
17
+ </svg>
18
+ </div>
19
+ `;
20
+
3
21
  exports[`Logo renders wise business logo 1`] = `
4
22
  <div>
5
- <img
23
+ <svg
6
24
  alt="Wise business"
7
- class="np-logo class"
8
- src="https://wise.com/public-resources/assets/logos/wise/brand_logo_business.svg"
9
- />
25
+ class="np-logo-svg class"
26
+ fill="none"
27
+ height="24"
28
+ width="106"
29
+ xmlns="http://www.w3.org/2000/svg"
30
+ >
31
+ <path
32
+ d="M58.738.359h6.498l-3.27 23.322h-6.498L58.739.359Zm-8.193 0L46.16 13.794 44.247.359h-4.545L33.96 13.754 33.243.36h-6.299l2.193 23.322h5.223l6.458-14.75 2.272 14.75h5.143L56.725.359h-6.18Zm54.558 13.555H89.674c.08 3.03 1.894 5.023 4.565 5.023 2.014 0 3.608-1.077 4.844-3.13l5.208 2.368C102.501 21.702 98.729 24 94.08 24c-6.339 0-10.545-4.266-10.545-11.123C83.535 5.342 88.478 0 95.455 0c6.14 0 10.007 4.146 10.007 10.605 0 1.076-.12 2.152-.359 3.309Zm-5.78-4.466c0-2.71-1.516-4.425-3.947-4.425-2.512 0-4.585 1.794-5.144 4.425h9.09ZM6.632 7.387 0 15.139h11.844l1.33-3.655H8.1l3.1-3.586.01-.095-2.016-3.471h9.072l-7.032 19.35h4.812L24.538.358H2.6l4.033 7.028Zm69.168-2.364c2.292 0 4.3 1.233 6.055 3.346l.921-6.575C81.143.688 78.93 0 76 0c-5.82 0-9.09 3.409-9.09 7.734 0 3 1.675 4.834 4.426 6.02l1.315.598c2.452 1.047 3.11 1.565 3.11 2.671 0 1.146-1.106 1.874-2.79 1.874-2.782.01-5.034-1.415-6.728-3.847l-.94 6.699C67.234 23.22 69.708 24 72.97 24c5.532 0 8.93-3.19 8.93-7.615 0-3.01-1.335-4.943-4.704-6.458l-1.435-.678c-1.994-.887-2.671-1.375-2.671-2.352 0-1.056.927-1.874 2.71-1.874Z"
33
+ fill="#163300"
34
+ />
35
+ </svg>
10
36
  </div>
11
37
  `;
12
38
 
13
39
  exports[`Logo renders wise business logo inversed 1`] = `
14
40
  <div>
15
- <img
41
+ <svg
16
42
  alt="Wise business"
17
- class="np-logo class"
18
- src="https://wise.com/public-resources/assets/logos/wise/brand_logo_business_inverse.svg"
19
- />
43
+ class="np-logo-svg class"
44
+ fill="none"
45
+ height="24"
46
+ width="106"
47
+ xmlns="http://www.w3.org/2000/svg"
48
+ >
49
+ <path
50
+ d="M58.738.359h6.498l-3.27 23.322h-6.498L58.739.359Zm-8.193 0L46.16 13.794 44.247.359h-4.545L33.96 13.754 33.243.36h-6.299l2.193 23.322h5.223l6.458-14.75 2.272 14.75h5.143L56.725.359h-6.18Zm54.558 13.555H89.674c.08 3.03 1.894 5.023 4.565 5.023 2.014 0 3.608-1.077 4.844-3.13l5.208 2.368C102.501 21.702 98.729 24 94.08 24c-6.339 0-10.545-4.266-10.545-11.123C83.535 5.342 88.478 0 95.455 0c6.14 0 10.007 4.146 10.007 10.605 0 1.076-.12 2.152-.359 3.309Zm-5.78-4.466c0-2.71-1.516-4.425-3.947-4.425-2.512 0-4.585 1.794-5.144 4.425h9.09ZM6.632 7.387 0 15.139h11.844l1.33-3.655H8.1l3.1-3.586.01-.095-2.016-3.471h9.072l-7.032 19.35h4.812L24.538.358H2.6l4.033 7.028Zm69.168-2.364c2.292 0 4.3 1.233 6.055 3.346l.921-6.575C81.143.688 78.93 0 76 0c-5.82 0-9.09 3.409-9.09 7.734 0 3 1.675 4.834 4.426 6.02l1.315.598c2.452 1.047 3.11 1.565 3.11 2.671 0 1.146-1.106 1.874-2.79 1.874-2.782.01-5.034-1.415-6.728-3.847l-.94 6.699C67.234 23.22 69.708 24 72.97 24c5.532 0 8.93-3.19 8.93-7.615 0-3.01-1.335-4.943-4.704-6.458l-1.435-.678c-1.994-.887-2.671-1.375-2.671-2.352 0-1.056.927-1.874 2.71-1.874Z"
51
+ fill="#9FE870"
52
+ />
53
+ </svg>
20
54
  </div>
21
55
  `;
22
56
 
23
57
  exports[`Logo renders wise logo 1`] = `
24
58
  <div>
25
- <img
59
+ <svg
26
60
  alt="Wise"
27
- class="np-logo class"
28
- src="https://wise.com/public-resources/assets/logos/wise/brand_logo.svg"
29
- />
61
+ class="np-logo-svg class"
62
+ fill="none"
63
+ height="24"
64
+ width="106"
65
+ xmlns="http://www.w3.org/2000/svg"
66
+ >
67
+ <path
68
+ d="M58.738.359h6.498l-3.27 23.322h-6.498L58.739.359Zm-8.193 0L46.16 13.794 44.247.359h-4.545L33.96 13.754 33.243.36h-6.299l2.193 23.322h5.223l6.458-14.75 2.272 14.75h5.143L56.725.359h-6.18Zm54.558 13.555H89.674c.08 3.03 1.894 5.023 4.565 5.023 2.014 0 3.608-1.077 4.844-3.13l5.208 2.368C102.501 21.702 98.729 24 94.08 24c-6.339 0-10.545-4.266-10.545-11.123C83.535 5.342 88.478 0 95.455 0c6.14 0 10.007 4.146 10.007 10.605 0 1.076-.12 2.152-.359 3.309Zm-5.78-4.466c0-2.71-1.516-4.425-3.947-4.425-2.512 0-4.585 1.794-5.144 4.425h9.09ZM6.632 7.387 0 15.139h11.844l1.33-3.655H8.1l3.1-3.586.01-.095-2.016-3.471h9.072l-7.032 19.35h4.812L24.538.358H2.6l4.033 7.028Zm69.168-2.364c2.292 0 4.3 1.233 6.055 3.346l.921-6.575C81.143.688 78.93 0 76 0c-5.82 0-9.09 3.409-9.09 7.734 0 3 1.675 4.834 4.426 6.02l1.315.598c2.452 1.047 3.11 1.565 3.11 2.671 0 1.146-1.106 1.874-2.79 1.874-2.782.01-5.034-1.415-6.728-3.847l-.94 6.699C67.234 23.22 69.708 24 72.97 24c5.532 0 8.93-3.19 8.93-7.615 0-3.01-1.335-4.943-4.704-6.458l-1.435-.678c-1.994-.887-2.671-1.375-2.671-2.352 0-1.056.927-1.874 2.71-1.874Z"
69
+ fill="#163300"
70
+ />
71
+ </svg>
30
72
  </div>
31
73
  `;
32
74
 
33
75
  exports[`Logo renders wise logo by default 1`] = `
34
76
  <div>
35
- <img
77
+ <svg
36
78
  alt="Wise"
37
- class="np-logo class"
38
- src="https://wise.com/public-resources/assets/logos/wise/brand_logo.svg"
39
- />
79
+ class="np-logo-svg class"
80
+ fill="none"
81
+ height="24"
82
+ width="106"
83
+ xmlns="http://www.w3.org/2000/svg"
84
+ >
85
+ <path
86
+ d="M58.738.359h6.498l-3.27 23.322h-6.498L58.739.359Zm-8.193 0L46.16 13.794 44.247.359h-4.545L33.96 13.754 33.243.36h-6.299l2.193 23.322h5.223l6.458-14.75 2.272 14.75h5.143L56.725.359h-6.18Zm54.558 13.555H89.674c.08 3.03 1.894 5.023 4.565 5.023 2.014 0 3.608-1.077 4.844-3.13l5.208 2.368C102.501 21.702 98.729 24 94.08 24c-6.339 0-10.545-4.266-10.545-11.123C83.535 5.342 88.478 0 95.455 0c6.14 0 10.007 4.146 10.007 10.605 0 1.076-.12 2.152-.359 3.309Zm-5.78-4.466c0-2.71-1.516-4.425-3.947-4.425-2.512 0-4.585 1.794-5.144 4.425h9.09ZM6.632 7.387 0 15.139h11.844l1.33-3.655H8.1l3.1-3.586.01-.095-2.016-3.471h9.072l-7.032 19.35h4.812L24.538.358H2.6l4.033 7.028Zm69.168-2.364c2.292 0 4.3 1.233 6.055 3.346l.921-6.575C81.143.688 78.93 0 76 0c-5.82 0-9.09 3.409-9.09 7.734 0 3 1.675 4.834 4.426 6.02l1.315.598c2.452 1.047 3.11 1.565 3.11 2.671 0 1.146-1.106 1.874-2.79 1.874-2.782.01-5.034-1.415-6.728-3.847l-.94 6.699C67.234 23.22 69.708 24 72.97 24c5.532 0 8.93-3.19 8.93-7.615 0-3.01-1.335-4.943-4.704-6.458l-1.435-.678c-1.994-.887-2.671-1.375-2.671-2.352 0-1.056.927-1.874 2.71-1.874Z"
87
+ fill="#163300"
88
+ />
89
+ </svg>
40
90
  </div>
41
91
  `;
42
92
 
43
93
  exports[`Logo renders wise logo inversed 1`] = `
44
94
  <div>
45
- <img
46
- alt="Wise"
47
- class="np-logo class"
48
- src="https://wise.com/public-resources/assets/logos/wise/brand_logo_inverse.svg"
49
- />
50
- </div>
51
- `;
52
-
53
- exports[`Logo on mobile renders only fast flag 1`] = `
54
- <div>
55
- <img
95
+ <svg
56
96
  alt="Wise"
57
- class="np-logo class"
58
- src="https://wise.com/public-resources/assets/logos/wise/brand_flag.svg"
59
- />
97
+ class="np-logo-svg class"
98
+ fill="none"
99
+ height="24"
100
+ width="106"
101
+ xmlns="http://www.w3.org/2000/svg"
102
+ >
103
+ <path
104
+ d="M58.738.359h6.498l-3.27 23.322h-6.498L58.739.359Zm-8.193 0L46.16 13.794 44.247.359h-4.545L33.96 13.754 33.243.36h-6.299l2.193 23.322h5.223l6.458-14.75 2.272 14.75h5.143L56.725.359h-6.18Zm54.558 13.555H89.674c.08 3.03 1.894 5.023 4.565 5.023 2.014 0 3.608-1.077 4.844-3.13l5.208 2.368C102.501 21.702 98.729 24 94.08 24c-6.339 0-10.545-4.266-10.545-11.123C83.535 5.342 88.478 0 95.455 0c6.14 0 10.007 4.146 10.007 10.605 0 1.076-.12 2.152-.359 3.309Zm-5.78-4.466c0-2.71-1.516-4.425-3.947-4.425-2.512 0-4.585 1.794-5.144 4.425h9.09ZM6.632 7.387 0 15.139h11.844l1.33-3.655H8.1l3.1-3.586.01-.095-2.016-3.471h9.072l-7.032 19.35h4.812L24.538.358H2.6l4.033 7.028Zm69.168-2.364c2.292 0 4.3 1.233 6.055 3.346l.921-6.575C81.143.688 78.93 0 76 0c-5.82 0-9.09 3.409-9.09 7.734 0 3 1.675 4.834 4.426 6.02l1.315.598c2.452 1.047 3.11 1.565 3.11 2.671 0 1.146-1.106 1.874-2.79 1.874-2.782.01-5.034-1.415-6.728-3.847l-.94 6.699C67.234 23.22 69.708 24 72.97 24c5.532 0 8.93-3.19 8.93-7.615 0-3.01-1.335-4.943-4.704-6.458l-1.435-.678c-1.994-.887-2.671-1.375-2.671-2.352 0-1.056.927-1.874 2.71-1.874Z"
105
+ fill="#9FE870"
106
+ />
107
+ </svg>
60
108
  </div>
61
109
  `;