@comicrelief/component-library 5.8.6 → 6.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.
- package/PULL_REQUEST_TEMPLATE.md +27 -5
- package/dist/components/Atoms/Select/Select.js +7 -3
- package/dist/components/Atoms/Select/__snapshots__/Select.test.js.snap +1 -0
- package/dist/components/Organisms/Donate/Form/Form.js +6 -2
- package/dist/components/Organisms/EmailSignUp/__snapshots__/EmailSignUp.test.js.snap +1 -0
- package/dist/index.js +1 -1
- package/package.json +1 -1
- package/src/components/Atoms/Select/Select.js +13 -3
- package/src/components/Atoms/Select/__snapshots__/Select.test.js.snap +1 -0
- package/src/components/Organisms/Donate/Form/Form.js +8 -1
- package/src/components/Organisms/EmailSignUp/__snapshots__/EmailSignUp.test.js.snap +1 -0
- package/src/index.js +1 -1
package/PULL_REQUEST_TEMPLATE.md
CHANGED
|
@@ -1,8 +1,30 @@
|
|
|
1
|
-
|
|
1
|
+
### PR Titles
|
|
2
|
+
#### To pass testing pipeline, these need to follow Conventional Commits spec:
|
|
3
|
+
https://www.conventionalcommits.org/en/v1.0.0/
|
|
4
|
+
e.g.
|
|
5
|
+
`feat: create NewForm component`
|
|
6
|
+
or
|
|
7
|
+
`fix: update broken link in NewForm component`
|
|
2
8
|
|
|
3
|
-
Fixes #
|
|
4
9
|
|
|
5
|
-
|
|
10
|
+
### PR description
|
|
11
|
+
#### What is it doing?
|
|
12
|
+
Tell us what it is doing from a technical perspective.
|
|
6
13
|
|
|
7
|
-
|
|
8
|
-
|
|
14
|
+
#### Why is this required?
|
|
15
|
+
Tell us why this is required from a business/product perspective.
|
|
16
|
+
|
|
17
|
+
#### link to Jira ticket:
|
|
18
|
+
Add a link to the Jira ticket.
|
|
19
|
+
|
|
20
|
+
|
|
21
|
+
### Quick Checklist:
|
|
22
|
+
- [ ] My PR title follows the Conventional Commit spec.
|
|
23
|
+
|
|
24
|
+
- [ ] I have filled out the PR description as per the template above.
|
|
25
|
+
|
|
26
|
+
- [ ] I have added tests to cover new or changed behaviour.
|
|
27
|
+
|
|
28
|
+
- [ ] I have updated any relevant documentation.
|
|
29
|
+
|
|
30
|
+
### Important! - lastly, make sure to squash merge...
|
|
@@ -23,7 +23,7 @@ var _dropDownDarkPurple = _interopRequireDefault(require("./assets/drop-down-dar
|
|
|
23
23
|
|
|
24
24
|
var _spacing = _interopRequireDefault(require("../../../theme/shared/spacing"));
|
|
25
25
|
|
|
26
|
-
var _excluded = ["errorMsg", "description", "label", "options", "hideLabel", "defaultValue", "onChange", "greyDescription", "className"];
|
|
26
|
+
var _excluded = ["errorMsg", "description", "label", "options", "hideLabel", "defaultValue", "onChange", "greyDescription", "className", "optional"];
|
|
27
27
|
|
|
28
28
|
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); }
|
|
29
29
|
|
|
@@ -68,6 +68,7 @@ var Select = /*#__PURE__*/_react.default.forwardRef(function (_ref8, ref) {
|
|
|
68
68
|
_onChange = _ref8.onChange,
|
|
69
69
|
greyDescription = _ref8.greyDescription,
|
|
70
70
|
className = _ref8.className,
|
|
71
|
+
optional = _ref8.optional,
|
|
71
72
|
rest = (0, _objectWithoutProperties2.default)(_ref8, _excluded);
|
|
72
73
|
|
|
73
74
|
var _useState = (0, _react.useState)(''),
|
|
@@ -79,7 +80,8 @@ var Select = /*#__PURE__*/_react.default.forwardRef(function (_ref8, ref) {
|
|
|
79
80
|
label: label,
|
|
80
81
|
hideLabel: hideLabel,
|
|
81
82
|
errorMsg: errorMsg,
|
|
82
|
-
className: className
|
|
83
|
+
className: className,
|
|
84
|
+
optional: optional
|
|
83
85
|
}, /*#__PURE__*/_react.default.createElement(StyledSelect, Object.assign({
|
|
84
86
|
onChange: function onChange(e) {
|
|
85
87
|
setValue(e.currentTarget.value);
|
|
@@ -91,6 +93,7 @@ var Select = /*#__PURE__*/_react.default.forwardRef(function (_ref8, ref) {
|
|
|
91
93
|
}, rest, {
|
|
92
94
|
error: errorMsg,
|
|
93
95
|
defaultValue: defaultValue,
|
|
96
|
+
required: optional === false,
|
|
94
97
|
hasValue: !!value,
|
|
95
98
|
greyDescription: greyDescription,
|
|
96
99
|
ref: ref
|
|
@@ -117,7 +120,8 @@ Select.defaultProps = {
|
|
|
117
120
|
/** If true, the 'description' option, which is initially selected but disabled, will be grey
|
|
118
121
|
* - like a text input's placeholder */
|
|
119
122
|
greyDescription: false,
|
|
120
|
-
className: ''
|
|
123
|
+
className: '',
|
|
124
|
+
optional: false
|
|
121
125
|
};
|
|
122
126
|
var _default = Select;
|
|
123
127
|
exports.default = _default;
|
|
@@ -62,8 +62,12 @@ var Signup = function Signup(_ref) {
|
|
|
62
62
|
setMoneyBuyCopy = _useState8[1];
|
|
63
63
|
|
|
64
64
|
(0, _react.useEffect)(function () {
|
|
65
|
-
var givingData = givingType === 'single' ? singleGiving : regularGiving;
|
|
66
|
-
|
|
65
|
+
var givingData = givingType === 'single' ? singleGiving : regularGiving; // Check the 2nd moneybuy exists before using it;
|
|
66
|
+
// 'philantrophy' carts have been set up to use a single moneybuy.
|
|
67
|
+
// See ENG-1685 for more details
|
|
68
|
+
|
|
69
|
+
var thisAmount = givingData.moneybuys[1] ? givingData.moneybuys[1].value : givingData.moneybuys[0].value;
|
|
70
|
+
setAmountDonate(parseFloat(thisAmount));
|
|
67
71
|
}, [givingType, singleGiving, regularGiving]);
|
|
68
72
|
(0, _react.useEffect)(function () {
|
|
69
73
|
var givingData = givingType === 'single' ? singleGiving : regularGiving;
|
package/dist/index.js
CHANGED
|
@@ -101,7 +101,7 @@ Object.defineProperty(exports, "Button", {
|
|
|
101
101
|
return _Button.default;
|
|
102
102
|
}
|
|
103
103
|
});
|
|
104
|
-
Object.defineProperty(exports, "
|
|
104
|
+
Object.defineProperty(exports, "RadioButton", {
|
|
105
105
|
enumerable: true,
|
|
106
106
|
get: function get() {
|
|
107
107
|
return _RadioButton.default;
|
package/package.json
CHANGED
|
@@ -49,6 +49,7 @@ const Select = React.forwardRef(
|
|
|
49
49
|
onChange,
|
|
50
50
|
greyDescription,
|
|
51
51
|
className,
|
|
52
|
+
optional,
|
|
52
53
|
...rest
|
|
53
54
|
},
|
|
54
55
|
ref
|
|
@@ -56,7 +57,13 @@ const Select = React.forwardRef(
|
|
|
56
57
|
const [value, setValue] = useState('');
|
|
57
58
|
|
|
58
59
|
return (
|
|
59
|
-
<Label
|
|
60
|
+
<Label
|
|
61
|
+
label={label}
|
|
62
|
+
hideLabel={hideLabel}
|
|
63
|
+
errorMsg={errorMsg}
|
|
64
|
+
className={className}
|
|
65
|
+
optional={optional}
|
|
66
|
+
>
|
|
60
67
|
<StyledSelect
|
|
61
68
|
onChange={e => {
|
|
62
69
|
setValue(e.currentTarget.value);
|
|
@@ -67,6 +74,7 @@ const Select = React.forwardRef(
|
|
|
67
74
|
{...rest}
|
|
68
75
|
error={errorMsg}
|
|
69
76
|
defaultValue={defaultValue}
|
|
77
|
+
required={optional === false}
|
|
70
78
|
hasValue={!!value}
|
|
71
79
|
greyDescription={greyDescription}
|
|
72
80
|
ref={ref}
|
|
@@ -102,7 +110,8 @@ Select.propTypes = {
|
|
|
102
110
|
greyDescription: PropTypes.bool,
|
|
103
111
|
// className is needed so that styled(`Select`) will work
|
|
104
112
|
// (as `rest` is not spread on the outermost component)
|
|
105
|
-
className: PropTypes.string
|
|
113
|
+
className: PropTypes.string,
|
|
114
|
+
optional: PropTypes.bool
|
|
106
115
|
};
|
|
107
116
|
|
|
108
117
|
Select.defaultProps = {
|
|
@@ -112,7 +121,8 @@ Select.defaultProps = {
|
|
|
112
121
|
/** If true, the 'description' option, which is initially selected but disabled, will be grey
|
|
113
122
|
* - like a text input's placeholder */
|
|
114
123
|
greyDescription: false,
|
|
115
|
-
className: ''
|
|
124
|
+
className: '',
|
|
125
|
+
optional: false
|
|
116
126
|
};
|
|
117
127
|
|
|
118
128
|
export default Select;
|
|
@@ -40,7 +40,14 @@ const Signup = ({
|
|
|
40
40
|
useEffect(() => {
|
|
41
41
|
const givingData = givingType === 'single' ? singleGiving : regularGiving;
|
|
42
42
|
|
|
43
|
-
|
|
43
|
+
// Check the 2nd moneybuy exists before using it;
|
|
44
|
+
// 'philantrophy' carts have been set up to use a single moneybuy.
|
|
45
|
+
// See ENG-1685 for more details
|
|
46
|
+
const thisAmount = givingData.moneybuys[1]
|
|
47
|
+
? givingData.moneybuys[1].value
|
|
48
|
+
: givingData.moneybuys[0].value;
|
|
49
|
+
|
|
50
|
+
setAmountDonate(parseFloat(thisAmount));
|
|
44
51
|
}, [givingType, singleGiving, regularGiving]);
|
|
45
52
|
|
|
46
53
|
useEffect(() => {
|
package/src/index.js
CHANGED
|
@@ -18,7 +18,7 @@ export { default as Logo } from './components/Atoms/Logo/Logo';
|
|
|
18
18
|
export { default as Picture } from './components/Atoms/Picture/Picture';
|
|
19
19
|
export { default as Link } from './components/Atoms/Link/Link';
|
|
20
20
|
export { default as Button } from './components/Atoms/Button/Button';
|
|
21
|
-
export { default as
|
|
21
|
+
export { default as RadioButton } from './components/Atoms/RadioButton/RadioButton';
|
|
22
22
|
export { default as Checkbox } from './components/Atoms/Checkbox/Checkbox';
|
|
23
23
|
export { default as Input } from './components/Atoms/Input/Input';
|
|
24
24
|
export { default as Select } from './components/Atoms/Select/Select';
|