@comicrelief/component-library 7.48.0 → 7.48.2

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.
package/babel.config.js CHANGED
@@ -3,7 +3,10 @@ module.exports = function (api) {
3
3
  api.cache(true);
4
4
 
5
5
  const presets = [ ["react-app", { "absoluteRuntime": false }] ];
6
- const plugins = [ ["babel-plugin-styled-components"] ];
6
+ const plugins = [
7
+ ["babel-plugin-styled-components"],
8
+ ["import", { "libraryName": "lodash", "libraryDirectory": "", "camel2DashComponentName": false }]
9
+ ];
7
10
 
8
11
  return {
9
12
  presets,
@@ -1,10 +1,11 @@
1
1
  "use strict";
2
2
 
3
+ var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault").default;
3
4
  Object.defineProperty(exports, "__esModule", {
4
5
  value: true
5
6
  });
6
7
  exports.getPages = exports.calculatePagesToTheRight = exports.calculatePagesToTheLeft = exports.calculateDisplayedPages = void 0;
7
- var _lodash = require("lodash");
8
+ var _range2 = _interopRequireDefault(require("lodash/range"));
8
9
  /**
9
10
  * Determines the number of displayed pages
10
11
  * @param {Integer} maxPages
@@ -63,12 +64,12 @@ const getPages = (currentPage, maxPages, totalPages) => {
63
64
  const displayedPages = calculateDisplayedPages(maxPages, totalPages);
64
65
  // If all pages are allowed, return the entire page range
65
66
  if (displayedPages === totalPages) {
66
- return (0, _lodash.range)(1, totalPages + 1);
67
+ return (0, _range2.default)(1, totalPages + 1);
67
68
  }
68
69
  const pagesToTheLeft = calculatePagesToTheLeft(currentPage, displayedPages, totalPages);
69
70
  const pagesToTheRight = calculatePagesToTheRight(currentPage, displayedPages, totalPages);
70
71
  const first = currentPage - pagesToTheLeft;
71
72
  const last = currentPage + pagesToTheRight;
72
- return (0, _lodash.range)(first, last + 1);
73
+ return (0, _range2.default)(first, last + 1);
73
74
  };
74
75
  exports.getPages = getPages;
@@ -1,13 +1,13 @@
1
1
  "use strict";
2
2
 
3
- var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault").default;
4
3
  var _interopRequireWildcard = require("@babel/runtime/helpers/interopRequireWildcard").default;
4
+ var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault").default;
5
5
  Object.defineProperty(exports, "__esModule", {
6
6
  value: true
7
7
  });
8
8
  exports.default = void 0;
9
+ var _debounce2 = _interopRequireDefault(require("lodash/debounce"));
9
10
  var _react = _interopRequireWildcard(require("react"));
10
- var _lodash = require("lodash");
11
11
  var _TextInputWithDropdown = _interopRequireDefault(require("../../Atoms/TextInputWithDropdown/TextInputWithDropdown"));
12
12
  // These just felt about right to me but could be changed.
13
13
  const DELAY_DURATION = 300;
@@ -52,7 +52,7 @@ const Typeahead = /*#__PURE__*/_react.default.forwardRef((_ref, ref) => {
52
52
  // useCallback is needed so that the debounced function is not recreated on each render.
53
53
  // (Dependency array needs to be empty to ensure that this is the case).
54
54
  // eslint-disable-next-line react-hooks/exhaustive-deps
55
- const debouncedHandleChange = (0, _react.useCallback)((0, _lodash.debounce)(handleChange, DELAY_DURATION), []);
55
+ const debouncedHandleChange = (0, _react.useCallback)((0, _debounce2.default)(handleChange, DELAY_DURATION), []);
56
56
  return /*#__PURE__*/_react.default.createElement(_TextInputWithDropdown.default, Object.assign({
57
57
  defaultValue: "",
58
58
  options: optionParser ? options.map(optionParser) : options,
@@ -1,11 +1,12 @@
1
1
  "use strict";
2
2
 
3
3
  var _interopRequireWildcard = require("@babel/runtime/helpers/interopRequireWildcard").default;
4
+ var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault").default;
4
5
  Object.defineProperty(exports, "__esModule", {
5
6
  value: true
6
7
  });
7
8
  exports.buildEsuValidationSchema = exports.ESU_FIELDS = void 0;
8
- var _lodash = require("lodash");
9
+ var _merge2 = _interopRequireDefault(require("lodash/merge"));
9
10
  var yup = _interopRequireWildcard(require("yup"));
10
11
  /**
11
12
  * ESU_FIELDS
@@ -35,6 +36,6 @@ const buildEsuValidationSchema = overrides => {
35
36
  [ESU_FIELDS.LAST_NAME]: yup.string().required('Please enter your last name').matches(/^[A-Za-z][A-Za-z' -]*$/, "This field only accepts letters and ' - and must start with a letter").max(50, 'Your first name must be between 1 and 50 characters'),
36
37
  [ESU_FIELDS.EMAIL]: yup.string().required('Please enter your email address').email('Please enter a valid email address').max(100, 'Your email address must be between 1 and 100 characters long')
37
38
  });
38
- return (0, _lodash.merge)(defaultSchema, overrides);
39
+ return (0, _merge2.default)(defaultSchema, overrides);
39
40
  };
40
41
  exports.buildEsuValidationSchema = buildEsuValidationSchema;
@@ -17,10 +17,10 @@ Object.defineProperty(exports, "setInitialValues", {
17
17
  return _MarketingPrefsConfig.setInitialValues;
18
18
  }
19
19
  });
20
+ var _isEmpty2 = _interopRequireDefault(require("lodash/isEmpty"));
20
21
  var _react = _interopRequireDefault(require("react"));
21
22
  var _propTypes = _interopRequireDefault(require("prop-types"));
22
23
  var _reactHookForm = require("react-hook-form");
23
- var _lodash = _interopRequireDefault(require("lodash"));
24
24
  var _CheckAnswer = _interopRequireDefault(require("./_CheckAnswer"));
25
25
  var _DefaultCopy = require("./_DefaultCopy");
26
26
  var _MarketingPreferencesDS = require("./MarketingPreferencesDS.style");
@@ -75,7 +75,7 @@ const MarketingPreferencesDS = _ref => {
75
75
 
76
76
  // Required to track multiple errors to determine whether to show/hide the fieldset
77
77
  const isAddressErroring = () => {
78
- if (_lodash.default.isEmpty(errors)) {
78
+ if ((0, _isEmpty2.default)(errors)) {
79
79
  return null;
80
80
  }
81
81
  return errors.mp_address1 || errors.mp_address2 || errors.mp_address3 || errors.mp_town || errors.mp_country || errors.mp_postcode;
@@ -1,12 +1,13 @@
1
1
  "use strict";
2
2
 
3
3
  var _interopRequireWildcard = require("@babel/runtime/helpers/interopRequireWildcard").default;
4
+ var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault").default;
4
5
  Object.defineProperty(exports, "__esModule", {
5
6
  value: true
6
7
  });
7
8
  exports.setInitialValues = exports.buildValidationSchema = void 0;
9
+ var _merge2 = _interopRequireDefault(require("lodash/merge"));
8
10
  var yup = _interopRequireWildcard(require("yup"));
9
- var _lodash = require("lodash");
10
11
  const setInitialValues = overrideValues => {
11
12
  const defaultValues = {
12
13
  mp_email: '',
@@ -25,7 +26,7 @@ const setInitialValues = overrideValues => {
25
26
  };
26
27
 
27
28
  // Override with any custom options supplied
28
- const updatedValues = (0, _lodash.merge)(defaultValues, overrideValues);
29
+ const updatedValues = (0, _merge2.default)(defaultValues, overrideValues);
29
30
  return updatedValues;
30
31
  };
31
32
  exports.setInitialValues = setInitialValues;
@@ -63,7 +64,7 @@ const buildValidationSchema = overrideOptions => {
63
64
  };
64
65
 
65
66
  // Override with any custom options supplied
66
- const mpValidationOptions = (0, _lodash.merge)(defaultOptions, overrideOptions);
67
+ const mpValidationOptions = (0, _merge2.default)(defaultOptions, overrideOptions);
67
68
  const phoneRegex = /^(((((\+44)|(0044))\s?\d{4}|\(?0\d{4}\)?)\s?\d{3}\s?\d{3})|((((\+44)|(0044))\s?\d{3}|\(?0\d{3}\)?)\s?\d{3}\s?\d{4})|((((\+44)|(0044))\s?\d{2}|\(?0\d{2}\)?)\s?\d{4}\s?\d{4}))(\s?\\#(\d{4}|\d{3}))?$/;
68
69
  const mpValidationSchema = yup.object({
69
70
  mp_email: yup.string().when('mp_permissionEmail', {
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.48.0",
4
+ "version": "7.48.2",
5
5
  "main": "dist/index.js",
6
6
  "license": "ISC",
7
7
  "jest": {
@@ -21,13 +21,8 @@
21
21
  "url": "https://github.com/comicrelief/component-library.git"
22
22
  },
23
23
  "dependencies": {
24
- "@babel/cli": "^7.21.5",
25
- "@babel/plugin-proposal-private-property-in-object": "^7.21.11",
26
24
  "@hookform/resolvers": "^1.3.4",
27
- "@playwright/test": "^1.38.1",
28
25
  "axios": "^0.21.1",
29
- "ejs": "^3.1.9",
30
- "jest-styled-components": "^7.1.1",
31
26
  "lazysizes": "^5.3.2",
32
27
  "lodash": "^4.17.11",
33
28
  "moment": "^2.29.4",
@@ -41,9 +36,7 @@
41
36
  "react-modal": "^3.16.1",
42
37
  "react-range-slider-input": "^3.0.7",
43
38
  "react-responsive": "^9.0.2",
44
- "react-scripts": "4.0.3",
45
39
  "react-spinners": "^0.11.0",
46
- "react-styleguidist": "^11.1.7",
47
40
  "react-test-renderer": "^17.0.2",
48
41
  "react-uid": "^2.3.3",
49
42
  "styled-components": "^5.3.11",
@@ -54,12 +47,11 @@
54
47
  "react-scripts/workbox-webpack-plugin/workbox-build/@surma/rollup-plugin-off-main-thread/ejs": "3.1.6"
55
48
  },
56
49
  "scripts": {
50
+ "build": "rm -rf dist && NODE_ENV=production babel src --out-dir dist --copy-files --ignore __tests__,spec.js,test.js",
57
51
  "test:unit": "yarn run jest",
58
52
  "test:unit:update": "yarn jest -u",
59
53
  "styleguide": "cross-env FAST_REFRESH=false styleguidist server",
60
54
  "styleguide:build": "styleguidist build",
61
- "postinstall": "yarn run build",
62
- "build": "rm -rf dist && NODE_ENV=production babel src --out-dir dist --copy-files --ignore __tests__,spec.js,test.js",
63
55
  "test:e2e": "playwright test --project=chromium",
64
56
  "test:e2e--h": "playwright test --project=chromium --headed",
65
57
  "test:e2e:ci": "NODE_ENV=development; start-server-and-test styleguide http://localhost:6060 test:e2e",
@@ -80,7 +72,12 @@
80
72
  ]
81
73
  },
82
74
  "devDependencies": {
75
+ "@babel/cli": "^7.21.5",
76
+ "@babel/plugin-proposal-private-property-in-object": "^7.21.11",
77
+ "@playwright/test": "^1.38.1",
78
+ "babel-plugin-import": "^1.13.8",
83
79
  "cross-env": "^7.0.3",
80
+ "ejs": "^3.1.9",
84
81
  "eslint": "^7.32.0",
85
82
  "eslint-config-airbnb": "^18.2.0",
86
83
  "eslint-plugin-import": "^2.27.5",
@@ -88,8 +85,11 @@
88
85
  "eslint-plugin-react": "^7.32.2",
89
86
  "eslint-plugin-react-hooks": "^4.6.0",
90
87
  "jest": "^26.1.0",
88
+ "jest-styled-components": "^7.1.1",
91
89
  "npm-run-all": "^4.1.5",
92
90
  "prettier": "^2.8.8",
91
+ "react-scripts": "4.0.3",
92
+ "react-styleguidist": "^11.1.7",
93
93
  "semantic-release": "^17.4.6",
94
94
  "start-server-and-test": "^2.0.0"
95
95
  }