@transferwise/components 46.0.8 → 46.1.0

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.
@@ -5,7 +5,7 @@ export type DateLookupSize = "sm" | "md" | "lg";
5
5
  export type DateLookupMonthFormat = "long" | "short";
6
6
 
7
7
  export interface DateLookupProps {
8
- value: Date;
8
+ value?: Date;
9
9
  min?: Date;
10
10
  max?: Date;
11
11
  size?: DateLookupSize;
@@ -1 +1 @@
1
- {"version":3,"file":"TypeaheadOption.d.ts","sourceRoot":"","sources":["../../../../src/typeahead/typeaheadOption/TypeaheadOption.js"],"names":[],"mappings":";AAMA,iEAmBC;;;;;;;;;;;;;QAgBU,kCAAQ"}
1
+ {"version":3,"file":"TypeaheadOption.d.ts","sourceRoot":"","sources":["../../../../src/typeahead/typeaheadOption/TypeaheadOption.js"],"names":[],"mappings":";AAMA,iEAqBC;;;;;;;;;;;;;QAgBU,kCAAQ"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@transferwise/components",
3
- "version": "46.0.8",
3
+ "version": "46.1.0",
4
4
  "description": "Neptune React components",
5
5
  "license": "Apache-2.0",
6
6
  "repository": {
@@ -78,12 +78,12 @@
78
78
  "rollup": "^3.28.1",
79
79
  "storybook": "^7.4.5",
80
80
  "@transferwise/less-config": "3.0.6",
81
- "@transferwise/neptune-css": "14.7.1",
81
+ "@transferwise/neptune-css": "14.8.0",
82
82
  "@wise/components-theming": "0.8.4"
83
83
  },
84
84
  "peerDependencies": {
85
85
  "@transferwise/icons": "^3.7.0",
86
- "@transferwise/neptune-css": "^14.7.0",
86
+ "@transferwise/neptune-css": "^14.8.0",
87
87
  "@wise/art": "^2.7.0",
88
88
  "@wise/components-theming": "^0.8.4",
89
89
  "currency-flags": "^4.0.2",
@@ -268,7 +268,7 @@ class DateLookup extends PureComponent {
268
268
  }
269
269
 
270
270
  DateLookup.propTypes = {
271
- value: PropTypes.instanceOf(Date).isRequired,
271
+ value: PropTypes.instanceOf(Date),
272
272
  min: PropTypes.instanceOf(Date),
273
273
  max: PropTypes.instanceOf(Date),
274
274
  size: PropTypes.oneOf(['sm', 'md', 'lg']),
@@ -283,6 +283,7 @@ DateLookup.propTypes = {
283
283
  };
284
284
 
285
285
  DateLookup.defaultProps = {
286
+ value: null,
286
287
  min: null,
287
288
  max: null,
288
289
  size: Size.MEDIUM,
@@ -0,0 +1,28 @@
1
+ import { render, mockMatchMedia } from '../test-utils';
2
+
3
+ import DateLookup from '.';
4
+
5
+ mockMatchMedia();
6
+
7
+ // This test suite could become redundant
8
+ // once we refactor the DateLookup component to TypeScript
9
+
10
+ describe('DateLookup propTypes', () => {
11
+ describe('when the value prop is set to null', () => {
12
+ it('renders without prop type warnings in the console', () => {
13
+ const consoleSpy = jest.spyOn(console, 'error').mockImplementation(() => {});
14
+
15
+ render(<DateLookup value={null} onChange={jest.fn()} />);
16
+
17
+ // eslint-disable-next-line no-console
18
+ expect(console.error).not.toHaveBeenCalledWith(
19
+ expect.stringContaining('Warning: Failed %s type'),
20
+ 'prop',
21
+ 'The prop `value` is marked as required in `DateLookup`, but its value is `null`.',
22
+ expect.anything(),
23
+ );
24
+
25
+ consoleSpy.mockRestore();
26
+ });
27
+ });
28
+ });
@@ -19,7 +19,9 @@ const Option = (props) => {
19
19
  <a className="dropdown-item" href="#" tabIndex={-1} onClick={onClick}>
20
20
  <span>{hightlight(label, query)}</span>
21
21
  {note && <span className="np-text-body-default m-l-1">{note}</span>}
22
- {secondary && <span className="np-text-body-default text-ellipsis">{secondary}</span>}
22
+ {secondary && (
23
+ <span className="np-text-body-default text-ellipsis">{hightlight(secondary, query)}</span>
24
+ )}
23
25
  </a>
24
26
  </li>
25
27
  );