@transferwise/components 46.28.0 → 46.29.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 (112) hide show
  1. package/build/i18n/hu.json +1 -1
  2. package/build/index.js +141 -686
  3. package/build/index.js.map +1 -1
  4. package/build/index.mjs +144 -686
  5. package/build/index.mjs.map +1 -1
  6. package/build/main.css +16 -5
  7. package/build/styles/logo/Logo.css +16 -0
  8. package/build/styles/main.css +16 -5
  9. package/build/types/alert/Alert.d.ts.map +1 -1
  10. package/build/types/common/hooks/index.d.ts +0 -1
  11. package/build/types/dimmer/Dimmer.d.ts.map +1 -1
  12. package/build/types/flowNavigation/FlowNavigation.d.ts +3 -3
  13. package/build/types/flowNavigation/FlowNavigation.d.ts.map +1 -1
  14. package/build/types/index.d.ts +0 -1
  15. package/build/types/index.d.ts.map +1 -1
  16. package/build/types/inputs/SelectInput.d.ts.map +1 -1
  17. package/build/types/inputs/_BottomSheet.d.ts.map +1 -1
  18. package/build/types/inputs/_Popover.d.ts.map +1 -1
  19. package/build/types/loader/Loader.d.ts.map +1 -1
  20. package/build/types/logo/Logo.d.ts.map +1 -1
  21. package/build/types/phoneNumberInput/PhoneNumberInput.d.ts.map +1 -1
  22. package/build/types/popover/Popover.d.ts.map +1 -1
  23. package/build/types/segmentedControl/SegmentedControl.d.ts +2 -2
  24. package/build/types/segmentedControl/SegmentedControl.d.ts.map +1 -1
  25. package/build/types/select/Select.d.ts.map +1 -1
  26. package/build/types/stepper/deviceDetection.d.ts.map +1 -1
  27. package/build/types/uploadInput/uploadButton/UploadButton.d.ts.map +1 -1
  28. package/package.json +10 -8
  29. package/src/accordion/Accordion.story.tsx +1 -1
  30. package/src/alert/Alert.tsx +2 -1
  31. package/src/avatar/colors/colors.ts +1 -1
  32. package/src/body/Body.spec.tsx +1 -1
  33. package/src/body/Body.story.tsx +8 -8
  34. package/src/checkbox/Checkbox.js +1 -1
  35. package/src/checkboxButton/CheckboxButton.spec.tsx +0 -1
  36. package/src/common/Option/Option.tsx +1 -1
  37. package/src/common/deviceDetection/deviceDetection.js +1 -1
  38. package/src/common/deviceDetection/deviceDetection.spec.js +4 -2
  39. package/src/common/hooks/index.js +0 -1
  40. package/src/common/responsivePanel/ResponsivePanel.spec.js +11 -15
  41. package/src/decision/Decision.spec.js +0 -2
  42. package/src/dimmer/Dimmer.tsx +6 -2
  43. package/src/flowNavigation/FlowNavigation.spec.js +7 -22
  44. package/src/flowNavigation/FlowNavigation.tsx +20 -33
  45. package/src/flowNavigation/__snapshots__/FlowNavigation.spec.js.snap +2 -2
  46. package/src/i18n/hu.json +1 -1
  47. package/src/index.ts +0 -1
  48. package/src/inlineAlert/InlineAlert.story.tsx +8 -7
  49. package/src/inputs/SelectInput.tsx +1 -0
  50. package/src/inputs/_BottomSheet.tsx +33 -28
  51. package/src/inputs/_Popover.tsx +23 -20
  52. package/src/link/Link.story.tsx +16 -16
  53. package/src/loader/Loader.tsx +0 -1
  54. package/src/logo/Logo.css +16 -0
  55. package/src/logo/Logo.js +4 -9
  56. package/src/logo/Logo.less +16 -0
  57. package/src/logo/__snapshots__/Logo.spec.js.snap +104 -8
  58. package/src/main.css +16 -5
  59. package/src/main.less +0 -1
  60. package/src/moneyInput/MoneyInput.story.tsx +3 -3
  61. package/src/nudge/Nudge.spec.tsx +5 -5
  62. package/src/phoneNumberInput/PhoneNumberInput.tsx +2 -1
  63. package/src/phoneNumberInput/utils/cleanNumber/cleanNumber.ts +1 -1
  64. package/src/popover/Popover.tsx +2 -1
  65. package/src/promoCard/PromoCard.tsx +1 -1
  66. package/src/provider/theme/ThemeProvider.story.tsx +21 -0
  67. package/src/radioGroup/RadioGroup.spec.js +1 -1
  68. package/src/section/Section.story.tsx +2 -1
  69. package/src/segmentedControl/SegmentedControl.spec.tsx +88 -2
  70. package/src/segmentedControl/SegmentedControl.story.tsx +54 -16
  71. package/src/segmentedControl/SegmentedControl.tsx +21 -33
  72. package/src/select/Select.js +2 -3
  73. package/src/stepper/deviceDetection.js +1 -2
  74. package/src/stepper/deviceDetection.spec.js +8 -3
  75. package/src/test-utils/index.js +1 -1
  76. package/src/test-utils/story-config.ts +1 -1
  77. package/src/title/Title.spec.tsx +1 -1
  78. package/src/typeahead/Typeahead.spec.js +4 -2
  79. package/src/upload/Upload.spec.js +8 -4
  80. package/src/uploadInput/uploadButton/UploadButton.tsx +1 -0
  81. package/build/styles/dynamicFieldDefinitionList/FormattedValue/FormattedValue.css +0 -5
  82. package/build/types/common/hooks/useClientWidth/useClientWidth.d.ts +0 -11
  83. package/build/types/common/hooks/useClientWidth/useClientWidth.d.ts.map +0 -1
  84. package/build/types/common/requirements.d.ts +0 -3
  85. package/build/types/common/requirements.d.ts.map +0 -1
  86. package/build/types/dynamicFieldDefinitionList/DynamicFieldDefinitionList.d.ts +0 -21
  87. package/build/types/dynamicFieldDefinitionList/DynamicFieldDefinitionList.d.ts.map +0 -1
  88. package/build/types/dynamicFieldDefinitionList/FormattedValue/FormattedValue.d.ts +0 -12
  89. package/build/types/dynamicFieldDefinitionList/FormattedValue/FormattedValue.d.ts.map +0 -1
  90. package/build/types/dynamicFieldDefinitionList/FormattedValue/index.d.ts +0 -2
  91. package/build/types/dynamicFieldDefinitionList/FormattedValue/index.d.ts.map +0 -1
  92. package/build/types/dynamicFieldDefinitionList/index.d.ts +0 -2
  93. package/build/types/dynamicFieldDefinitionList/index.d.ts.map +0 -1
  94. package/build/types/dynamicFieldDefinitionList/utils/createDefinitions.d.ts +0 -2
  95. package/build/types/dynamicFieldDefinitionList/utils/createDefinitions.d.ts.map +0 -1
  96. package/build/types/dynamicFieldDefinitionList/utils/text-format.d.ts +0 -2
  97. package/build/types/dynamicFieldDefinitionList/utils/text-format.d.ts.map +0 -1
  98. package/src/common/hooks/useClientWidth/useClientWidth.spec.js +0 -77
  99. package/src/common/hooks/useClientWidth/useClientWidth.tsx +0 -47
  100. package/src/dynamicFieldDefinitionList/DynamicFieldDefinitionList.js +0 -41
  101. package/src/dynamicFieldDefinitionList/DynamicFieldDefinitionList.spec.js +0 -21
  102. package/src/dynamicFieldDefinitionList/DynamicFieldDefinitionList.story.js +0 -134
  103. package/src/dynamicFieldDefinitionList/FormattedValue/FormattedValue.css +0 -5
  104. package/src/dynamicFieldDefinitionList/FormattedValue/FormattedValue.js +0 -73
  105. package/src/dynamicFieldDefinitionList/FormattedValue/FormattedValue.less +0 -4
  106. package/src/dynamicFieldDefinitionList/FormattedValue/FormattedValue.spec.js +0 -200
  107. package/src/dynamicFieldDefinitionList/FormattedValue/index.js +0 -1
  108. package/src/dynamicFieldDefinitionList/index.js +0 -1
  109. package/src/dynamicFieldDefinitionList/utils/createDefinitions.js +0 -33
  110. package/src/dynamicFieldDefinitionList/utils/createDefinitions.spec.js +0 -83
  111. package/src/dynamicFieldDefinitionList/utils/text-format.js +0 -46
  112. package/src/dynamicFieldDefinitionList/utils/text-format.spec.js +0 -43
@@ -2,11 +2,11 @@ import '@testing-library/jest-dom';
2
2
 
3
3
  import Avatar, { AvatarType } from '../avatar';
4
4
  import { Breakpoint, Size } from '../common';
5
- import { render, screen } from '../test-utils';
5
+ import { mockMatchMedia, render, screen } from '../test-utils';
6
6
 
7
7
  import FlowNavigation from './FlowNavigation';
8
8
 
9
- jest.mock('lodash.throttle', () => jest.fn((fn) => fn));
9
+ mockMatchMedia();
10
10
 
11
11
  jest.mock('./animatedLabel', () => {
12
12
  return function ({ className, activeLabel }) {
@@ -24,23 +24,8 @@ jest.mock('./backButton', () => {
24
24
  });
25
25
 
26
26
  describe('FlowNavigation', () => {
27
- const resetClientWidth = (width) => {
28
- Object.defineProperty(HTMLElement.prototype, 'clientWidth', {
29
- configurable: true,
30
- value: width,
31
- });
32
- };
33
27
  beforeEach(() => {
34
- resetClientWidth(Breakpoint.LARGE + 1);
35
- });
36
-
37
- afterAll(() => {
38
- const originalClientWidth = Object.getOwnPropertyDescriptor(
39
- HTMLElement.prototype,
40
- 'clientWidth',
41
- );
42
-
43
- Object.defineProperty(HTMLElement.prototype, 'clientWidth', originalClientWidth);
28
+ window.innerWidth = Breakpoint.LARGE + 1;
44
29
  });
45
30
 
46
31
  const props = {
@@ -117,21 +102,21 @@ describe('FlowNavigation', () => {
117
102
  });
118
103
 
119
104
  it(`renders xs-max class`, () => {
120
- resetClientWidth(Breakpoint.SMALL - 1);
105
+ window.innerWidth = Breakpoint.SMALL - 1;
121
106
  const { container } = render(<FlowNavigation {...props} onClose={null} />);
122
107
 
123
108
  expect(container.querySelector('.np-flow-navigation--xs-max')).toBeInTheDocument();
124
109
  });
125
110
 
126
111
  it(`renders sm class`, () => {
127
- resetClientWidth(Breakpoint.SMALL);
112
+ window.innerWidth = Breakpoint.SMALL;
128
113
  const { container } = render(<FlowNavigation {...props} onClose={null} />);
129
114
 
130
115
  expect(container.querySelector('.np-flow-navigation--sm')).toBeInTheDocument();
131
116
  });
132
117
 
133
118
  it(`renders lg class`, () => {
134
- resetClientWidth(Breakpoint.LARGE);
119
+ window.innerWidth = Breakpoint.LARGE;
135
120
  const { container } = render(<FlowNavigation {...props} onClose={null} />);
136
121
 
137
122
  expect(container.querySelector('.np-flow-navigation--lg')).toBeInTheDocument();
@@ -139,7 +124,7 @@ describe('FlowNavigation', () => {
139
124
 
140
125
  describe('on mobile', () => {
141
126
  beforeEach(() => {
142
- resetClientWidth(Breakpoint.SMALL - 1);
127
+ window.innerWidth = Breakpoint.SMALL - 1;
143
128
  });
144
129
 
145
130
  it('renders as expected', () => {
@@ -1,18 +1,17 @@
1
1
  import classNames from 'classnames';
2
2
  import { useRef } from 'react';
3
- import React from 'react';
4
3
  import { useIntl } from 'react-intl';
5
4
 
6
5
  import { Breakpoint, Layout } from '../common';
7
6
  import { CloseButton } from '../common/closeButton';
8
7
  import FlowHeader from '../common/flowHeader/FlowHeader';
9
- import { useClientWidth } from '../common/hooks';
10
8
  import Logo from '../logo';
11
- import Stepper, { Step } from '../stepper/Stepper';
9
+ import Stepper, { type Step } from '../stepper/Stepper';
12
10
 
13
11
  import messages from './FlowNavigation.messages';
14
12
  import AnimatedLabel from './animatedLabel';
15
13
  import BackButton from './backButton';
14
+ import { useScreenSize } from '../common/hooks/useScreenSize';
16
15
 
17
16
  export interface FlowNavigationProps {
18
17
  activeStep?: number;
@@ -36,13 +35,12 @@ const FlowNavigation = ({
36
35
  onGoBack,
37
36
  steps,
38
37
  }: FlowNavigationProps) => {
39
- const reference = useRef<HTMLDivElement>(null);
40
38
  const intl = useIntl();
41
39
 
42
- const [clientWidth] = useClientWidth({ ref: reference });
43
40
  const closeButton = onClose != null && <CloseButton size="lg" onClick={onClose} />;
44
- const isSmall = clientWidth != null && clientWidth < Breakpoint.SMALL;
45
- const isLarge = clientWidth != null && clientWidth >= Breakpoint.LARGE;
41
+
42
+ const screenSm = useScreenSize(Breakpoint.SMALL);
43
+ const screenLg = useScreenSize(Breakpoint.LARGE);
46
44
 
47
45
  const newAvatar = done ? null : avatar;
48
46
 
@@ -50,28 +48,31 @@ const FlowNavigation = ({
50
48
 
51
49
  return (
52
50
  <div
53
- ref={reference}
54
51
  className={classNames(
55
52
  'np-flow-navigation d-flex align-items-center justify-content-center p-y-3',
56
53
  { 'np-flow-navigation--border-bottom': !done },
57
54
  )}
58
55
  >
59
56
  <FlowHeader
60
- className={classNames('np-flow-navigation__content p-x-3', {
61
- 'np-flow-navigation--hidden': !clientWidth,
62
- 'np-flow-navigation--xs-max': isSmall,
63
- // Size switches on parent container which may or may not have the same size as the window.
64
- 'np-flow-navigation--sm': clientWidth != null && clientWidth >= Breakpoint.SMALL,
65
- 'np-flow-navigation--lg': isLarge,
66
- })}
57
+ className={classNames(
58
+ 'np-flow-navigation__content p-x-3',
59
+ screenSm == null
60
+ ? 'np-flow-navigation--hidden'
61
+ : {
62
+ 'np-flow-navigation--xs-max': !screenSm,
63
+ // Size switches on parent container which may or may not have the same size as the window.
64
+ 'np-flow-navigation--sm': screenSm,
65
+ 'np-flow-navigation--lg': screenLg,
66
+ },
67
+ )}
67
68
  leftContent={
68
69
  <>
69
- {isSmall && displayGoBack ? (
70
+ {!screenSm && displayGoBack ? (
70
71
  <BackButton aria-label={intl.formatMessage(messages.back)} onClick={onGoBack} />
71
72
  ) : (
72
73
  <div className="np-flow-header__left">{logo}</div>
73
74
  )}
74
- {isSmall && (
75
+ {!screenSm && (
75
76
  <AnimatedLabel
76
77
  className="m-x-1"
77
78
  labels={steps.map((step) => step.label)}
@@ -81,17 +82,7 @@ const FlowNavigation = ({
81
82
  </>
82
83
  }
83
84
  rightContent={
84
- <div
85
- className={classNames(
86
- 'np-flow-header__right',
87
- 'd-flex',
88
- 'align-items-center',
89
- 'justify-content-end',
90
- {
91
- 'order-2': isLarge,
92
- },
93
- )}
94
- >
85
+ <div className="np-flow-header__right d-flex align-items-center justify-content-end order-2--lg">
95
86
  {newAvatar}
96
87
  {newAvatar && closeButton && <span className="m-x-1" />}
97
88
  {closeButton}
@@ -106,11 +97,7 @@ const FlowNavigation = ({
106
97
  />
107
98
  )
108
99
  }
109
- layout={
110
- clientWidth != null && clientWidth < Breakpoint.LARGE
111
- ? Layout.VERTICAL
112
- : Layout.HORIZONTAL
113
- }
100
+ layout={!screenLg ? Layout.VERTICAL : Layout.HORIZONTAL}
114
101
  />
115
102
  </div>
116
103
  );
@@ -18,7 +18,7 @@ exports[`FlowNavigation on mobile renders as expected 1`] = `
18
18
  AnimatedLabel
19
19
  </div>
20
20
  <div
21
- class="np-flow-header__right d-flex align-items-center justify-content-end"
21
+ class="np-flow-header__right d-flex align-items-center justify-content-end order-2--lg"
22
22
  >
23
23
  <div
24
24
  class="tw-avatar tw-avatar--48 tw-avatar--initials np-text-title-body"
@@ -134,7 +134,7 @@ exports[`FlowNavigation renders as expected 1`] = `
134
134
  />
135
135
  </div>
136
136
  <div
137
- class="np-flow-header__right d-flex align-items-center justify-content-end order-2"
137
+ class="np-flow-header__right d-flex align-items-center justify-content-end order-2--lg"
138
138
  >
139
139
  <div
140
140
  class="tw-avatar tw-avatar--48 tw-avatar--initials np-text-title-body"
package/src/i18n/hu.json CHANGED
@@ -35,7 +35,7 @@
35
35
  "neptune.Upload.psProcessingText": "Feltöltés...",
36
36
  "neptune.Upload.usButtonText": "Vagy válaszd ki a fájlt",
37
37
  "neptune.Upload.usDropMessage": "Húzd ide a fájlokat a feltöltéshez",
38
- "neptune.Upload.usPlaceholder": "Húzz ide egy legfeljebb {maxSize} MB méretű fájlt",
38
+ "neptune.Upload.usPlaceholder": "Húzz ide egy legfeljebb {maxSize}MB méretű fájlt",
39
39
  "neptune.UploadButton.allFileTypes": "Összes fájltípus",
40
40
  "neptune.UploadButton.dropFiles": "Húzd a fájlokat ide a feltöltéshez",
41
41
  "neptune.UploadButton.instructions": "{fileTypes}, legfeljebb {size}MB",
package/src/index.ts CHANGED
@@ -98,7 +98,6 @@ export { default as Dimmer } from './dimmer';
98
98
  export { default as Display } from './display';
99
99
  export { default as Drawer } from './drawer';
100
100
  export { default as DropFade } from './dropFade';
101
- export { default as DynamicFieldDefinitionList } from './dynamicFieldDefinitionList';
102
101
  export { default as Emphasis } from './emphasis';
103
102
  export { default as FlowNavigation } from './flowNavigation/FlowNavigation';
104
103
  export { default as Header } from './header';
@@ -31,21 +31,22 @@ export const Basic = () => {
31
31
 
32
32
  let typeClass = '';
33
33
  switch (type) {
34
- case 'error':
35
- case 'negative':
34
+ case Sentiment.ERROR:
35
+ case Sentiment.NEGATIVE:
36
36
  typeClass = 'has-error';
37
37
  break;
38
- case 'success':
39
- case 'positive':
38
+ case Sentiment.SUCCESS:
39
+ case Sentiment.POSITIVE:
40
40
  typeClass = 'has-success';
41
41
  break;
42
- case 'info':
43
- case 'neutral':
42
+ case Sentiment.INFO:
43
+ case Sentiment.NEUTRAL:
44
44
  typeClass = 'has-info';
45
45
  break;
46
- case 'warning':
46
+ case Sentiment.WARNING:
47
47
  typeClass = 'has-warning';
48
48
  break;
49
+ case Sentiment.PENDING:
49
50
  }
50
51
 
51
52
  return (
@@ -180,6 +180,7 @@ const defaultRenderTrigger = (({ content, placeholderShown, clear, disabled, siz
180
180
  </span>
181
181
  </span>
182
182
  ),
183
+ initialContentWidth: 24 + 4,
183
184
  padding: 'sm',
184
185
  }}
185
186
  disabled={disabled}
@@ -7,6 +7,7 @@ import {
7
7
  useRole,
8
8
  } from '@floating-ui/react';
9
9
  import { Transition } from '@headlessui/react';
10
+ import { FocusScope } from '@react-aria/focus';
10
11
  import { ThemeProvider, useTheme } from '@wise/components-theming';
11
12
  import classNames from 'classnames';
12
13
  import { useState } from 'react';
@@ -97,37 +98,41 @@ export function BottomSheet({
97
98
  leave="np-bottom-sheet-v2-content--leave"
98
99
  leaveTo="np-bottom-sheet-v2-content--leave-to"
99
100
  >
100
- <FloatingFocusManager context={context} initialFocus={initialFocusRef}>
101
- <div
102
- key={floatingKey} // Force inner state invalidation on open
103
- ref={refs.setFloating}
104
- className="np-bottom-sheet-v2-content-inner-container"
105
- {...getFloatingProps()}
106
- >
107
- <div className="np-bottom-sheet-v2-header">
108
- <CloseButton
109
- size={Size.SMALL}
110
- onClick={() => {
111
- onClose?.();
112
- }}
113
- />
114
- </div>
101
+ <FocusScope>
102
+ <FloatingFocusManager context={context} initialFocus={initialFocusRef}>
115
103
  <div
116
- className={classNames(
117
- 'np-bottom-sheet-v2-content-inner',
118
- title && 'np-bottom-sheet-v2-content-inner--has-title',
119
- {
120
- 'np-bottom-sheet-v2-content-inner--padding-md': padding === 'md',
121
- },
122
- )}
104
+ key={floatingKey} // Force inner state invalidation on open
105
+ ref={refs.setFloating}
106
+ className="np-bottom-sheet-v2-content-inner-container"
107
+ {...getFloatingProps()}
123
108
  >
124
- {title ? (
125
- <h2 className="np-bottom-sheet-v2-title np-text-title-body">{title}</h2>
126
- ) : null}
127
- <div className="np-bottom-sheet-v2-body np-text-body-default">{children}</div>
109
+ <div className="np-bottom-sheet-v2-header">
110
+ <CloseButton
111
+ size={Size.SMALL}
112
+ onClick={() => {
113
+ onClose?.();
114
+ }}
115
+ />
116
+ </div>
117
+ <div
118
+ className={classNames(
119
+ 'np-bottom-sheet-v2-content-inner',
120
+ title && 'np-bottom-sheet-v2-content-inner--has-title',
121
+ {
122
+ 'np-bottom-sheet-v2-content-inner--padding-md': padding === 'md',
123
+ },
124
+ )}
125
+ >
126
+ {title ? (
127
+ <h2 className="np-bottom-sheet-v2-title np-text-title-body">{title}</h2>
128
+ ) : null}
129
+ <div className="np-bottom-sheet-v2-body np-text-body-default">
130
+ {children}
131
+ </div>
132
+ </div>
128
133
  </div>
129
- </div>
130
- </FloatingFocusManager>
134
+ </FloatingFocusManager>
135
+ </FocusScope>
131
136
  </Transition.Child>
132
137
  </div>
133
138
  </Transition>
@@ -13,6 +13,7 @@ import {
13
13
  useRole,
14
14
  } from '@floating-ui/react';
15
15
  import { Transition } from '@headlessui/react';
16
+ import { FocusScope } from '@react-aria/focus';
16
17
  import { ThemeProvider, useTheme } from '@wise/components-theming';
17
18
  import classNames from 'classnames';
18
19
  import { useState } from 'react';
@@ -103,30 +104,32 @@ export function Popover({
103
104
  }}
104
105
  afterLeave={onCloseEnd}
105
106
  >
106
- <FloatingFocusManager context={context}>
107
- <div
108
- key={floatingKey} // Force inner state invalidation on open
109
- ref={refs.setFloating}
110
- className={classNames('np-popover-v2-container', {
111
- 'np-popover-v2-container--size-md': size === 'md',
112
- 'np-popover-v2-container--size-lg': size === 'lg',
113
- })}
114
- // eslint-disable-next-line react/forbid-dom-props
115
- style={floatingStyles}
116
- {...getFloatingProps()}
117
- >
107
+ <FocusScope>
108
+ <FloatingFocusManager context={context}>
118
109
  <div
119
- className={classNames('np-popover-v2', title && 'np-popover-v2--has-title', {
120
- 'np-popover-v2--padding-md': padding === 'md',
110
+ key={floatingKey} // Force inner state invalidation on open
111
+ ref={refs.setFloating}
112
+ className={classNames('np-popover-v2-container', {
113
+ 'np-popover-v2-container--size-md': size === 'md',
114
+ 'np-popover-v2-container--size-lg': size === 'lg',
121
115
  })}
116
+ // eslint-disable-next-line react/forbid-dom-props
117
+ style={floatingStyles}
118
+ {...getFloatingProps()}
122
119
  >
123
- {title ? (
124
- <h2 className="np-popover-v2-title np-text-title-body">{title}</h2>
125
- ) : null}
126
- <div className="np-popover-v2-content np-text-body-default">{children}</div>
120
+ <div
121
+ className={classNames('np-popover-v2', title && 'np-popover-v2--has-title', {
122
+ 'np-popover-v2--padding-md': padding === 'md',
123
+ })}
124
+ >
125
+ {title ? (
126
+ <h2 className="np-popover-v2-title np-text-title-body">{title}</h2>
127
+ ) : null}
128
+ <div className="np-popover-v2-content np-text-body-default">{children}</div>
129
+ </div>
127
130
  </div>
128
- </div>
129
- </FloatingFocusManager>
131
+ </FloatingFocusManager>
132
+ </FocusScope>
130
133
  </Transition>
131
134
  </ThemeProvider>
132
135
  </FloatingPortal>
@@ -29,64 +29,64 @@ export const Basic = () => {
29
29
  Links via <code>{'<Link />'}</code> component in all types of body copy
30
30
  </Title>
31
31
  <Body type={Typography.BODY_LARGE_BOLD} className="m-t-3">
32
- We’re building the world's{' '}
32
+ We’re building the worlds{' '}
33
33
  <Link href="#" target="_blank">
34
34
  most international account
35
35
  </Link>
36
- . We’re building the world's most international account
36
+ . We’re building the worlds most international account
37
37
  </Body>
38
38
  <Body type={Typography.BODY_LARGE} className="m-t-3">
39
- We’re building the world's{' '}
39
+ We’re building the worlds{' '}
40
40
  <Link href="#" target="_blank">
41
41
  most international account
42
42
  </Link>
43
- . We’re building the world's most international account
43
+ . We’re building the worlds most international account
44
44
  </Body>
45
45
  <Body type={Typography.BODY_DEFAULT_BOLD} className="m-t-3">
46
- We’re building the world's{' '}
46
+ We’re building the worlds{' '}
47
47
  <Link href="#" target="_blank">
48
48
  most international account
49
49
  </Link>
50
- . We’re building the world's most international account
50
+ . We’re building the worlds most international account
51
51
  </Body>
52
52
  <Body type={Typography.BODY_DEFAULT} className="m-t-3">
53
- We’re building the world's{' '}
53
+ We’re building the worlds{' '}
54
54
  <Link href="#" target="_blank">
55
55
  most international account
56
56
  </Link>
57
- . We’re building the world's most international account
57
+ . We’re building the worlds most international account
58
58
  </Body>
59
59
 
60
60
  <Title type={Typography.TITLE_SCREEN} className="m-t-3">
61
61
  Links via <code>{'<a>'}</code> tag in all types of body copy
62
62
  </Title>
63
63
  <Body type={Typography.BODY_LARGE_BOLD} className="m-t-3">
64
- We’re building the world's{' '}
64
+ We’re building the worlds{' '}
65
65
  <a href="#" target="_blank">
66
66
  most international account
67
67
  </a>
68
- . We’re building the world's most international account
68
+ . We’re building the worlds most international account
69
69
  </Body>
70
70
  <Body type={Typography.BODY_LARGE} className="m-t-3">
71
- We’re building the world's{' '}
71
+ We’re building the worlds{' '}
72
72
  <a href="#" target="_blank">
73
73
  most international account
74
74
  </a>
75
- . We’re building the world's most international account
75
+ . We’re building the worlds most international account
76
76
  </Body>
77
77
  <Body type={Typography.BODY_DEFAULT_BOLD} className="m-t-3">
78
- We’re building the world's{' '}
78
+ We’re building the worlds{' '}
79
79
  <a href="#" target="_blank">
80
80
  most international account
81
81
  </a>
82
- . We’re building the world's most international account
82
+ . We’re building the worlds most international account
83
83
  </Body>
84
84
  <Body type={Typography.BODY_DEFAULT} className="m-t-3">
85
- We’re building the world's{' '}
85
+ We’re building the worlds{' '}
86
86
  <a href="#" target="_blank">
87
87
  most international account
88
88
  </a>
89
- . We’re building the world's most international account
89
+ . We’re building the worlds most international account
90
90
  </Body>
91
91
  </>
92
92
  );
@@ -54,7 +54,6 @@ const Loader = ({
54
54
  }
55
55
 
56
56
  return () => {
57
- // eslint-disable-next-line fp/no-mutation
58
57
  cancelled = true;
59
58
 
60
59
  clearTimeout(timeout);
package/src/logo/Logo.css CHANGED
@@ -8,3 +8,19 @@
8
8
  .np-theme-personal--dark .np-logo-svg path {
9
9
  fill: var(--color-white);
10
10
  }
11
+ .np-logo-svg--size-sm {
12
+ display: block;
13
+ }
14
+ @media (min-width: 576px) {
15
+ .np-logo-svg--size-sm {
16
+ display: none;
17
+ }
18
+ }
19
+ .np-logo-svg--size-md {
20
+ display: none;
21
+ }
22
+ @media (min-width: 576px) {
23
+ .np-logo-svg--size-md {
24
+ display: block;
25
+ }
26
+ }
package/src/logo/Logo.js CHANGED
@@ -1,9 +1,6 @@
1
1
  import classNames from 'classnames';
2
2
  import PropTypes from 'prop-types';
3
3
 
4
- import { Breakpoint } from '../common';
5
- import { useScreenSize } from '../common/hooks/useScreenSize';
6
-
7
4
  import { LogoType } from './logoTypes';
8
5
  import { ReactComponent as LogoFlagInverse } from './svg/flag-inverse.svg';
9
6
  import { ReactComponent as LogoFlagPlatformInverse } from './svg/flag-platform-white.svg';
@@ -34,22 +31,20 @@ const Logo = ({ className, inverse, type }) => {
34
31
  ];
35
32
  const LogoMd = svgPaths[`${type}${inverse ? '_INVERSE' : ''}`];
36
33
 
37
- const screenMd = useScreenSize(Breakpoint.MEDIUM);
38
-
39
34
  return (
40
35
  <span
41
36
  aria-label={
42
37
  type === LogoType.WISE
43
38
  ? 'Wise'
44
39
  : 'Wise Business' | (type === LogoType.WISE_PLATFORM)
45
- ? 'Wise Platform'
46
- : 'Wise Business'
40
+ ? 'Wise Platform'
41
+ : 'Wise Business'
47
42
  }
48
43
  role="img"
49
44
  className={classNames(className, 'np-logo')}
50
45
  >
51
- {!screenMd && <LogoSm className="np-logo-svg" />}
52
- {screenMd && <LogoMd className="np-logo-svg" />}
46
+ <LogoSm className="np-logo-svg np-logo-svg--size-sm" />
47
+ <LogoMd className="np-logo-svg np-logo-svg--size-md" />
53
48
  </span>
54
49
  );
55
50
  };
@@ -13,4 +13,20 @@
13
13
  fill: var(--color-white);
14
14
  }
15
15
  }
16
+
17
+ &--size-sm {
18
+ display: block;
19
+
20
+ @media (--screen-sm) {
21
+ display: none;
22
+ }
23
+ }
24
+
25
+ &--size-md {
26
+ display: none;
27
+
28
+ @media (--screen-sm) {
29
+ display: block;
30
+ }
31
+ }
16
32
  }