@comicrelief/component-library 7.16.0 → 7.17.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.
@@ -114,7 +114,7 @@ Input.propTypes = {
114
114
 
115
115
  /** text, email, number, date, search, tel, url, password */
116
116
  type: _propTypes.default.string.isRequired,
117
- labelProps: _propTypes.default.objectOf(_propTypes.default.any),
117
+ labelProps: _propTypes.default.objectOf(_propTypes.default.string),
118
118
  // className is needed so that styled(`Input`) will work
119
119
  // (as `rest` is not spread on the outermost component)
120
120
  className: _propTypes.default.string,
@@ -21,7 +21,7 @@ var _Text = _interopRequireDefault(require("../Text/Text"));
21
21
 
22
22
  var _TextInputWithDropdown = require("./TextInputWithDropdown.style");
23
23
 
24
- var _excluded = ["value", "options", "onChange", "onSelect", "id", "name", "label", "dropdownInstruction", "className"],
24
+ var _excluded = ["options", "onChange", "onSelect", "id", "name", "label", "dropdownInstruction", "className"],
25
25
  _excluded2 = ["options", "dropdownInstruction", "onSelect", "activeOption", "resetActiveOption"];
26
26
 
27
27
  function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function _getRequireWildcardCache(nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
@@ -37,14 +37,13 @@ var KEY_CODE_ESCAPE = 27;
37
37
  * This component deals with the visual aspect of a text input with typeahead-style functionality
38
38
  *
39
39
  * API querying and state management (aside from that related to keyboard usage/accessibility) are
40
- * handled by the parent component (via the value, options, onChange and onSelect props)
40
+ * handled by the parent component (options, onChange and onSelect props)
41
41
  *
42
42
  * See the Typeahead and SchoolLookup molecules for the full implementation
43
43
  */
44
44
 
45
45
  var TextInputWithDropdown = /*#__PURE__*/_react.default.forwardRef(function (_ref, ref) {
46
- var value = _ref.value,
47
- options = _ref.options,
46
+ var options = _ref.options,
48
47
  onChange = _ref.onChange,
49
48
  onSelect = _ref.onSelect,
50
49
  id = _ref.id,
@@ -97,7 +96,6 @@ var TextInputWithDropdown = /*#__PURE__*/_react.default.forwardRef(function (_re
97
96
  };
98
97
 
99
98
  var inputProps = (0, _objectSpread2.default)({
100
- value: value,
101
99
  onChange: onChange,
102
100
  id: id,
103
101
  name: name,
@@ -98,7 +98,7 @@ var Donate = function Donate(_ref) {
98
98
  "aria-live": "polite"
99
99
  }, /*#__PURE__*/_react.default.createElement(_Donate.Header, {
100
100
  formAlignRight: formAlignRight
101
- }, /*#__PURE__*/_react.default.createElement(_Donate.HeaderInner, null, subtitle && /*#__PURE__*/_react.default.createElement(_react.default.Fragment, null, /*#__PURE__*/_react.default.createElement(_Text.default, {
101
+ }, /*#__PURE__*/_react.default.createElement(_Donate.HeaderInner, null, Boolean(subtitle) && /*#__PURE__*/_react.default.createElement(_react.default.Fragment, null, Boolean(title) && /*#__PURE__*/_react.default.createElement(_Text.default, {
102
102
  tag: "h2",
103
103
  color: textColor,
104
104
  size: "big",
@@ -146,7 +146,8 @@ Donate.defaultProps = {
146
146
  PopUpText: 'Help us deliver long-term impact by converting your single donation into a monthly gift.',
147
147
  chooseAmountText: '',
148
148
  isDesktopOverride: null,
149
- otherAmountValue: null
149
+ otherAmountValue: null,
150
+ title: null
150
151
  };
151
152
  var _default = Donate;
152
153
  exports.default = _default;
@@ -252,7 +252,8 @@ var Signup = function Signup(_ref) {
252
252
 
253
253
  Signup.defaultProps = {
254
254
  noMoneyBuys: false,
255
- data: {}
255
+ data: {},
256
+ otherAmountValue: null
256
257
  };
257
258
  var _default = Signup;
258
259
  exports.default = _default;
@@ -32,7 +32,6 @@ var GivingSelector = function GivingSelector(_ref) {
32
32
  value: "Single",
33
33
  type: "radio",
34
34
  label: "",
35
- errormsg: "",
36
35
  checked: givingType === 'single',
37
36
  onClick: function onClick() {
38
37
  return handleGivingTypeChange('single', givingType);
@@ -47,7 +46,6 @@ var GivingSelector = function GivingSelector(_ref) {
47
46
  value: "Monthly",
48
47
  type: "radio",
49
48
  label: "",
50
- errormsg: "",
51
49
  checked: givingType === 'monthly',
52
50
  onClick: function onClick() {
53
51
  return handleGivingTypeChange('monthly', givingType);
@@ -543,7 +543,6 @@ exports[`"Single Giving, No Money Buys, with overridden manual input value" rend
543
543
  aria-label="Single"
544
544
  checked={true}
545
545
  className="give-once"
546
- errormsg=""
547
546
  id="give-once--mship-4"
548
547
  label=""
549
548
  onClick={[Function]}
@@ -560,7 +559,6 @@ exports[`"Single Giving, No Money Buys, with overridden manual input value" rend
560
559
  aria-label="Monthly"
561
560
  checked={false}
562
561
  className="give-monthly"
563
- errormsg=""
564
562
  id="give-monthly--mship-4"
565
563
  label=""
566
564
  onClick={[Function]}
@@ -1286,7 +1284,6 @@ exports[`Monthly donation renders correctly 1`] = `
1286
1284
  aria-label="Single"
1287
1285
  checked={true}
1288
1286
  className="give-once"
1289
- errormsg=""
1290
1287
  id="give-once--mship-1"
1291
1288
  label=""
1292
1289
  onClick={[Function]}
@@ -1303,7 +1300,6 @@ exports[`Monthly donation renders correctly 1`] = `
1303
1300
  aria-label="Monthly"
1304
1301
  checked={false}
1305
1302
  className="give-monthly"
1306
- errormsg=""
1307
1303
  id="give-monthly--mship-1"
1308
1304
  label=""
1309
1305
  onClick={[Function]}
@@ -397,7 +397,7 @@ exports[`renders correctly 1`] = `
397
397
  Subscribe
398
398
  </span>
399
399
  <div
400
- className="ButtonWithStates__LoaderContainer-sc-7gb81g-1"
400
+ className=""
401
401
  />
402
402
  </button>
403
403
  </div>
@@ -563,7 +563,7 @@ exports[`renders correctly 1`] = `
563
563
  className="c2"
564
564
  >
565
565
  <div
566
- className="Footerstyle__SocialIconWrapper-sc-167xaf5-7"
566
+ className=""
567
567
  >
568
568
  <ul
569
569
  className="c3"
@@ -21,6 +21,8 @@ exports.MarketingPreferencesDS = void 0;
21
21
 
22
22
  var _react = _interopRequireDefault(require("react"));
23
23
 
24
+ var _propTypes = _interopRequireDefault(require("prop-types"));
25
+
24
26
  var _reactHookForm = require("react-hook-form");
25
27
 
26
28
  var _lodash = _interopRequireDefault(require("lodash"));
@@ -221,4 +223,12 @@ MarketingPreferencesDS.defaultProps = {
221
223
  copyBottom: _DefaultCopy.defaultCopyBottom,
222
224
  id: null,
223
225
  formContext: null
226
+ };
227
+ MaybeDisabled.propTypes = {
228
+ children: _propTypes.default.node,
229
+ disabled: _propTypes.default.bool
230
+ };
231
+ MaybeDisabled.defaultProps = {
232
+ children: null,
233
+ disabled: false
224
234
  };
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.16.0",
4
+ "version": "7.17.0",
5
5
  "main": "dist/index.js",
6
6
  "license": "ISC",
7
7
  "jest": {
@@ -21,29 +21,29 @@
21
21
  "url": "https://github.com/comicrelief/component-library.git"
22
22
  },
23
23
  "dependencies": {
24
- "@babel/cli": "^7.14.8",
24
+ "@babel/cli": "^7.21.5",
25
25
  "@hookform/resolvers": "^1.3.4",
26
26
  "axios": "^0.21.1",
27
27
  "ejs": "^3.1.9",
28
- "jest-styled-components": "^7.0.5",
28
+ "jest-styled-components": "^7.1.1",
29
29
  "lazysizes": "^5.3.2",
30
30
  "lodash": "^4.17.11",
31
31
  "moment": "^2.29.4",
32
- "prop-types": "^15.7.2",
32
+ "prop-types": "^15.8.1",
33
33
  "react": "^17.0.2",
34
- "react-canvas-confetti": "^1.3.0",
35
- "react-currency-format": "^1.0.0",
34
+ "react-canvas-confetti": "^1.4.0",
35
+ "react-currency-format": "^1.1.0",
36
36
  "react-dom": "^17.0.2",
37
37
  "react-hook-form": "^6.3.0",
38
- "react-modal": "^3.14.3",
38
+ "react-modal": "^3.16.1",
39
39
  "react-responsive": "^9.0.2",
40
40
  "react-scripts": "4.0.3",
41
41
  "react-spinners": "^0.11.0",
42
42
  "react-styleguidist": "^11.1.7",
43
43
  "react-test-renderer": "^17.0.2",
44
- "react-uid": "^2.3.2",
45
- "styled-components": "^5.3.1",
46
- "youtube-player": "^5.5.2",
44
+ "react-uid": "^2.3.3",
45
+ "styled-components": "^5.3.11",
46
+ "youtube-player": "^5.6.0",
47
47
  "yup": "^0.32.9"
48
48
  },
49
49
  "resolutions": {
@@ -78,13 +78,13 @@
78
78
  "cypress": "^8.3.0",
79
79
  "eslint": "^7.32.0",
80
80
  "eslint-config-airbnb": "^18.2.0",
81
- "eslint-plugin-import": "^2.24.2",
82
- "eslint-plugin-jsx-a11y": "^6.3.1",
83
- "eslint-plugin-react": "^7.24.0",
84
- "eslint-plugin-react-hooks": "^4.0.5",
81
+ "eslint-plugin-import": "^2.27.5",
82
+ "eslint-plugin-jsx-a11y": "^6.7.1",
83
+ "eslint-plugin-react": "^7.32.2",
84
+ "eslint-plugin-react-hooks": "^4.6.0",
85
85
  "jest": "^26.1.0",
86
86
  "npm-run-all": "^4.1.5",
87
- "prettier": "^2.3.2",
87
+ "prettier": "^2.8.8",
88
88
  "semantic-release": "^17.4.6"
89
89
  }
90
90
  }
@@ -23,7 +23,7 @@ const InputField = styled.input`${({ theme, error, prefixLength }) => css`
23
23
  border-color: ${error ? theme.color('red') : theme.color('grey_medium')};
24
24
  box-shadow: none;
25
25
  appearance: none;
26
- color: ${theme.color('black')};
26
+ color: ${theme.color('black')};
27
27
  border-radius: ${spacing('sm')};
28
28
  font-size: inherit;
29
29
  z-index: 2;
@@ -119,7 +119,7 @@ Input.propTypes = {
119
119
  id: PropTypes.string.isRequired,
120
120
  /** text, email, number, date, search, tel, url, password */
121
121
  type: PropTypes.string.isRequired,
122
- labelProps: PropTypes.objectOf(PropTypes.any),
122
+ labelProps: PropTypes.objectOf(PropTypes.string),
123
123
  // className is needed so that styled(`Input`) will work
124
124
  // (as `rest` is not spread on the outermost component)
125
125
  className: PropTypes.string,
@@ -22,14 +22,13 @@ const KEY_CODE_ESCAPE = 27;
22
22
  * This component deals with the visual aspect of a text input with typeahead-style functionality
23
23
  *
24
24
  * API querying and state management (aside from that related to keyboard usage/accessibility) are
25
- * handled by the parent component (via the value, options, onChange and onSelect props)
25
+ * handled by the parent component (options, onChange and onSelect props)
26
26
  *
27
27
  * See the Typeahead and SchoolLookup molecules for the full implementation
28
28
  */
29
29
  const TextInputWithDropdown = React.forwardRef(
30
30
  (
31
31
  {
32
- value,
33
32
  options,
34
33
  onChange,
35
34
  onSelect,
@@ -76,7 +75,6 @@ const TextInputWithDropdown = React.forwardRef(
76
75
  };
77
76
 
78
77
  const inputProps = {
79
- value,
80
78
  onChange,
81
79
  id,
82
80
  name,
@@ -178,7 +176,6 @@ const Options = ({
178
176
  };
179
177
 
180
178
  TextInputWithDropdown.propTypes = {
181
- value: PropTypes.string.isRequired,
182
179
  options: PropTypes.arrayOf(PropTypes.string).isRequired,
183
180
  onChange: PropTypes.func.isRequired,
184
181
  onSelect: PropTypes.func.isRequired,
@@ -92,8 +92,9 @@ const Donate = ({
92
92
  <Wrapper formAlignRight={formAlignRight} aria-live="polite">
93
93
  <Header formAlignRight={formAlignRight}>
94
94
  <HeaderInner>
95
- {subtitle && (
95
+ {Boolean(subtitle) && (
96
96
  <>
97
+ {Boolean(title) && (
97
98
  <Text
98
99
  tag="h2"
99
100
  color={textColor}
@@ -104,6 +105,8 @@ const Donate = ({
104
105
  >
105
106
  {title}
106
107
  </Text>
108
+ )}
109
+
107
110
  <Text tag="p" color={textColor} size="m">
108
111
  {subtitle}
109
112
  </Text>
@@ -136,7 +139,7 @@ Donate.propTypes = {
136
139
  data: PropTypes.objectOf(PropTypes.shape),
137
140
  clientID: PropTypes.string.isRequired,
138
141
  donateLink: PropTypes.string.isRequired,
139
- title: PropTypes.string.isRequired,
142
+ title: PropTypes.string,
140
143
  otherAmountText: PropTypes.string,
141
144
  subtitle: PropTypes.string,
142
145
  formAlignRight: PropTypes.bool,
@@ -182,7 +185,8 @@ Donate.defaultProps = {
182
185
  PopUpText: 'Help us deliver long-term impact by converting your single donation into a monthly gift.',
183
186
  chooseAmountText: '',
184
187
  isDesktopOverride: null,
185
- otherAmountValue: null
188
+ otherAmountValue: null,
189
+ title: null
186
190
  };
187
191
 
188
192
  export default Donate;
@@ -313,12 +313,13 @@ Signup.propTypes = {
313
313
  PopUpText: PropTypes.string.isRequired,
314
314
  chooseAmountText: PropTypes.string.isRequired,
315
315
  submitButtonColor: PropTypes.string.isRequired,
316
- otherAmountValue: PropTypes.number.isRequired
316
+ otherAmountValue: PropTypes.number
317
317
  };
318
318
 
319
319
  Signup.defaultProps = {
320
320
  noMoneyBuys: false,
321
- data: {}
321
+ data: {},
322
+ otherAmountValue: null
322
323
  };
323
324
 
324
325
  export default Signup;
@@ -26,7 +26,6 @@ const GivingSelector = ({
26
26
  value="Single"
27
27
  type="radio"
28
28
  label=""
29
- errormsg=""
30
29
  checked={givingType === 'single'}
31
30
  onClick={() => handleGivingTypeChange('single', givingType)}
32
31
  />
@@ -40,7 +39,6 @@ const GivingSelector = ({
40
39
  value="Monthly"
41
40
  type="radio"
42
41
  label=""
43
- errormsg=""
44
42
  checked={givingType === 'monthly'}
45
43
  onClick={() => handleGivingTypeChange('monthly', givingType)}
46
44
  />
@@ -543,7 +543,6 @@ exports[`"Single Giving, No Money Buys, with overridden manual input value" rend
543
543
  aria-label="Single"
544
544
  checked={true}
545
545
  className="give-once"
546
- errormsg=""
547
546
  id="give-once--mship-4"
548
547
  label=""
549
548
  onClick={[Function]}
@@ -560,7 +559,6 @@ exports[`"Single Giving, No Money Buys, with overridden manual input value" rend
560
559
  aria-label="Monthly"
561
560
  checked={false}
562
561
  className="give-monthly"
563
- errormsg=""
564
562
  id="give-monthly--mship-4"
565
563
  label=""
566
564
  onClick={[Function]}
@@ -1286,7 +1284,6 @@ exports[`Monthly donation renders correctly 1`] = `
1286
1284
  aria-label="Single"
1287
1285
  checked={true}
1288
1286
  className="give-once"
1289
- errormsg=""
1290
1287
  id="give-once--mship-1"
1291
1288
  label=""
1292
1289
  onClick={[Function]}
@@ -1303,7 +1300,6 @@ exports[`Monthly donation renders correctly 1`] = `
1303
1300
  aria-label="Monthly"
1304
1301
  checked={false}
1305
1302
  className="give-monthly"
1306
- errormsg=""
1307
1303
  id="give-monthly--mship-1"
1308
1304
  label=""
1309
1305
  onClick={[Function]}
@@ -397,7 +397,7 @@ exports[`renders correctly 1`] = `
397
397
  Subscribe
398
398
  </span>
399
399
  <div
400
- className="ButtonWithStates__LoaderContainer-sc-7gb81g-1"
400
+ className=""
401
401
  />
402
402
  </button>
403
403
  </div>
@@ -563,7 +563,7 @@ exports[`renders correctly 1`] = `
563
563
  className="c2"
564
564
  >
565
565
  <div
566
- className="Footerstyle__SocialIconWrapper-sc-167xaf5-7"
566
+ className=""
567
567
  >
568
568
  <ul
569
569
  className="c3"
@@ -263,6 +263,16 @@ MarketingPreferencesDS.defaultProps = {
263
263
  formContext: null
264
264
  };
265
265
 
266
+ MaybeDisabled.propTypes = {
267
+ children: PropTypes.node,
268
+ disabled: PropTypes.bool
269
+ };
270
+
271
+ MaybeDisabled.defaultProps = {
272
+ children: null,
273
+ disabled: false
274
+ };
275
+
266
276
  export {
267
277
  MarketingPreferencesDS, setInitialValues, buildValidationSchema
268
278
  };