@thecb/components 8.4.9-beta.0 → 8.4.10-beta.1
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/dist/index.cjs.js +27 -4
- package/dist/index.cjs.js.map +1 -1
- package/dist/index.esm.js +27 -4
- package/dist/index.esm.js.map +1 -1
- package/package.json +1 -1
- package/src/components/atoms/form-select/FormSelect.js +0 -1
- package/src/components/atoms/radio-button-with-label/RadioButtonWithLabel.js +53 -33
- package/src/components/molecules/radio-group/RadioGroup.js +2 -0
- package/src/components/molecules/radio-group/RadioGroup.stories.js +1 -1
- package/dist/src/apps/checkout/pages/payment/sub-pages/payment-amount/PaymentAmount_old.js +0 -49322
- package/src/.DS_Store +0 -0
- package/src/components/.DS_Store +0 -0
- package/src/components/atoms/.DS_Store +0 -0
- package/src/components/atoms/icons/.DS_Store +0 -0
package/dist/index.cjs.js
CHANGED
|
@@ -24235,8 +24235,7 @@ var FormSelect = function FormSelect(_ref) {
|
|
|
24235
24235
|
variant: "pXS",
|
|
24236
24236
|
weight: themeValues.fontWeight,
|
|
24237
24237
|
extraStyles: "word-break: break-word;\n font-family: Public Sans;\n &::first-letter {\n text-transform: uppercase;\n }",
|
|
24238
|
-
id: createIdFromString(labelTextWhenNoError, "error message")
|
|
24239
|
-
"aria-live": "polite"
|
|
24238
|
+
id: createIdFromString(labelTextWhenNoError, "error message")
|
|
24240
24239
|
}, errorMessages[field.errors[0]]) : /*#__PURE__*/React__default.createElement(Text$1, {
|
|
24241
24240
|
extraStyles: "height: ".concat(themeValues.lineHeight, ";")
|
|
24242
24241
|
})));
|
|
@@ -27109,7 +27108,29 @@ var RadioButtonWithLabel = function RadioButtonWithLabel(_ref5) {
|
|
|
27109
27108
|
themeValues = _ref5.themeValues,
|
|
27110
27109
|
index = _ref5.index,
|
|
27111
27110
|
_ref5$handleChange = _ref5.handleChange,
|
|
27112
|
-
handleChange = _ref5$handleChange === void 0 ? noop : _ref5$handleChange
|
|
27111
|
+
handleChange = _ref5$handleChange === void 0 ? noop : _ref5$handleChange,
|
|
27112
|
+
field = _ref5.field,
|
|
27113
|
+
config = _ref5.config;
|
|
27114
|
+
|
|
27115
|
+
var getDefaultChecked = function getDefaultChecked(value, idx) {
|
|
27116
|
+
var selectionExistsInConfig = config.map(function (c) {
|
|
27117
|
+
return c.value;
|
|
27118
|
+
}).includes(field.rawValue);
|
|
27119
|
+
|
|
27120
|
+
if (selectionExistsInConfig) {
|
|
27121
|
+
if (field.rawValue === value) {
|
|
27122
|
+
return true;
|
|
27123
|
+
}
|
|
27124
|
+
} else {
|
|
27125
|
+
if (idx === 0) {
|
|
27126
|
+
// fallback to first option as default selection
|
|
27127
|
+
return true;
|
|
27128
|
+
}
|
|
27129
|
+
}
|
|
27130
|
+
|
|
27131
|
+
return false;
|
|
27132
|
+
};
|
|
27133
|
+
|
|
27113
27134
|
return /*#__PURE__*/React__default.createElement(InputAndLabelContainer, {
|
|
27114
27135
|
align: "center",
|
|
27115
27136
|
childGap: "0.5rem",
|
|
@@ -27127,7 +27148,7 @@ var RadioButtonWithLabel = function RadioButtonWithLabel(_ref5) {
|
|
|
27127
27148
|
setValue(e.target.value);
|
|
27128
27149
|
handleChange(e);
|
|
27129
27150
|
},
|
|
27130
|
-
defaultChecked: index
|
|
27151
|
+
defaultChecked: getDefaultChecked(value, index)
|
|
27131
27152
|
}), /*#__PURE__*/React__default.createElement(Text$1, {
|
|
27132
27153
|
as: "label",
|
|
27133
27154
|
htmlFor: id,
|
|
@@ -49383,6 +49404,8 @@ var RadioGroup = function RadioGroup(_ref) {
|
|
|
49383
49404
|
groupName: groupName,
|
|
49384
49405
|
setValue: setValue,
|
|
49385
49406
|
handleChange: handleChange,
|
|
49407
|
+
field: field,
|
|
49408
|
+
config: config,
|
|
49386
49409
|
"aria-invalid": field.dirty && field.hasErrors
|
|
49387
49410
|
}));
|
|
49388
49411
|
})));
|