@comicrelief/component-library 7.19.2 → 7.20.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.
@@ -19,7 +19,7 @@ var _axios = _interopRequireDefault(require("axios"));
19
19
 
20
20
  var _Lookup = _interopRequireDefault(require("../Lookup/Lookup"));
21
21
 
22
- var _excluded = ["onSelect"];
22
+ var _excluded = ["onSelect", "noResultsMessage"];
23
23
 
24
24
  var schoolFetcher = /*#__PURE__*/function () {
25
25
  var _ref = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee(query) {
@@ -94,6 +94,7 @@ var schoolToString = function schoolToString(school) {
94
94
 
95
95
  var SimpleSchoolLookup = function SimpleSchoolLookup(_ref2) {
96
96
  var onSelect = _ref2.onSelect,
97
+ noResultsMessage = _ref2.noResultsMessage,
97
98
  rest = (0, _objectWithoutProperties2.default)(_ref2, _excluded);
98
99
  return /*#__PURE__*/_react.default.createElement(_Lookup.default, Object.assign({
99
100
  name: "school_lookup",
@@ -101,12 +102,15 @@ var SimpleSchoolLookup = function SimpleSchoolLookup(_ref2) {
101
102
  placeholder: "Enter name or postcode...",
102
103
  buttonText: "Find school",
103
104
  dropdownInstruction: "Please select an organisation from the list below",
104
- noResultsMessage: "Sorry, could not find anything matching your search",
105
+ noResultsMessage: noResultsMessage,
105
106
  lookupHandler: schoolFetcher,
106
107
  mapOptionToString: schoolToString,
107
108
  onSelect: onSelect
108
109
  }, rest));
109
110
  };
110
111
 
112
+ SimpleSchoolLookup.defaultProps = {
113
+ noResultsMessage: 'Sorry, we could not find anything matching your search; please use the manual entry option.'
114
+ };
111
115
  var _default = SimpleSchoolLookup;
112
116
  exports.default = _default;
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@comicrelief/component-library",
3
3
  "author": "Comic Relief Engineering Team",
4
- "version": "7.19.2",
4
+ "version": "7.20.0",
5
5
  "main": "dist/index.js",
6
6
  "license": "ISC",
7
7
  "jest": {
@@ -41,14 +41,14 @@ const schoolToString = school => `${school.name}, ${school.post_code}`;
41
41
  * @returns {JSX.Element}
42
42
  * @constructor
43
43
  */
44
- const SimpleSchoolLookup = ({ onSelect, ...rest }) => (
44
+ const SimpleSchoolLookup = ({ onSelect, noResultsMessage, ...rest }) => (
45
45
  <Lookup
46
46
  name="school_lookup"
47
47
  label="Enter the name or postcode of your organisation"
48
48
  placeholder="Enter name or postcode..."
49
49
  buttonText="Find school"
50
50
  dropdownInstruction="Please select an organisation from the list below"
51
- noResultsMessage="Sorry, could not find anything matching your search"
51
+ noResultsMessage={noResultsMessage}
52
52
  lookupHandler={schoolFetcher}
53
53
  mapOptionToString={schoolToString}
54
54
  onSelect={onSelect}
@@ -56,8 +56,13 @@ const SimpleSchoolLookup = ({ onSelect, ...rest }) => (
56
56
  />
57
57
  );
58
58
 
59
+ SimpleSchoolLookup.defaultProps = {
60
+ noResultsMessage: 'Sorry, we could not find anything matching your search; please use the manual entry option.'
61
+ };
62
+
59
63
  SimpleSchoolLookup.propTypes = {
60
- onSelect: PropTypes.func.isRequired
64
+ onSelect: PropTypes.func.isRequired,
65
+ noResultsMessage: PropTypes.string
61
66
  };
62
67
 
63
68
  export default SimpleSchoolLookup;