@sb1/ffe-form-react 20.1.1 → 20.1.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.
@@ -25,12 +25,12 @@ import classNames from 'classnames';
25
25
  import { v4 as uuid } from 'uuid';
26
26
  import { Tooltip } from './Tooltip';
27
27
  export var BaseRadioButton = React.forwardRef(function (_a, ref) {
28
- var children = _a.children, checked = _a.checked, className = _a.className, labelProps = _a.labelProps, selectedValue = _a.selectedValue, tooltip = _a.tooltip, _b = _a.tooltipProps, tooltipProps = _b === void 0 ? {} : _b, value = _a.value, inputProps = __rest(_a, ["children", "checked", "className", "labelProps", "selectedValue", "tooltip", "tooltipProps", "value"]);
28
+ var children = _a.children, checked = _a.checked, className = _a.className, labelProps = _a.labelProps, selectedValue = _a.selectedValue, tooltip = _a.tooltip, _b = _a.tooltipProps, tooltipProps = _b === void 0 ? {} : _b, value = _a.value, _c = _a.onChange, onChange = _c === void 0 ? function () { } : _c, inputProps = __rest(_a, ["children", "checked", "className", "labelProps", "selectedValue", "tooltip", "tooltipProps", "value", "onChange"]);
29
29
  var id = useRef("base-radio-button-".concat(uuid())).current;
30
30
  var labelClasses = classNames({ 'ffe-radio-button--with-tooltip': tooltip }, className);
31
31
  var isSelected = selectedValue === undefined ? checked : selectedValue === value;
32
32
  return (React.createElement(React.Fragment, null,
33
- React.createElement("input", __assign({ className: "ffe-radio-input", id: id, ref: ref, type: "radio", checked: isSelected, value: "".concat(value) }, inputProps)),
33
+ React.createElement("input", __assign({ className: "ffe-radio-input", id: id, ref: ref, type: "radio", checked: !!isSelected, value: "".concat(value), onChange: onChange }, inputProps)),
34
34
  React.createElement("label", __assign({ htmlFor: id }, labelProps, { className: labelClasses }),
35
35
  React.createElement("span", { className: "ffe-radio-input__content" }, children)),
36
36
  tooltip && React.createElement(Tooltip, __assign({}, tooltipProps), tooltip)));
@@ -54,12 +54,12 @@ var classnames_1 = __importDefault(require("classnames"));
54
54
  var uuid_1 = require("uuid");
55
55
  var Tooltip_1 = require("./Tooltip");
56
56
  exports.BaseRadioButton = react_1.default.forwardRef(function (_a, ref) {
57
- var children = _a.children, checked = _a.checked, className = _a.className, labelProps = _a.labelProps, selectedValue = _a.selectedValue, tooltip = _a.tooltip, _b = _a.tooltipProps, tooltipProps = _b === void 0 ? {} : _b, value = _a.value, inputProps = __rest(_a, ["children", "checked", "className", "labelProps", "selectedValue", "tooltip", "tooltipProps", "value"]);
57
+ var children = _a.children, checked = _a.checked, className = _a.className, labelProps = _a.labelProps, selectedValue = _a.selectedValue, tooltip = _a.tooltip, _b = _a.tooltipProps, tooltipProps = _b === void 0 ? {} : _b, value = _a.value, _c = _a.onChange, onChange = _c === void 0 ? function () { } : _c, inputProps = __rest(_a, ["children", "checked", "className", "labelProps", "selectedValue", "tooltip", "tooltipProps", "value", "onChange"]);
58
58
  var id = (0, react_1.useRef)("base-radio-button-".concat((0, uuid_1.v4)())).current;
59
59
  var labelClasses = (0, classnames_1.default)({ 'ffe-radio-button--with-tooltip': tooltip }, className);
60
60
  var isSelected = selectedValue === undefined ? checked : selectedValue === value;
61
61
  return (react_1.default.createElement(react_1.default.Fragment, null,
62
- react_1.default.createElement("input", __assign({ className: "ffe-radio-input", id: id, ref: ref, type: "radio", checked: isSelected, value: "".concat(value) }, inputProps)),
62
+ react_1.default.createElement("input", __assign({ className: "ffe-radio-input", id: id, ref: ref, type: "radio", checked: !!isSelected, value: "".concat(value), onChange: onChange }, inputProps)),
63
63
  react_1.default.createElement("label", __assign({ htmlFor: id }, labelProps, { className: labelClasses }),
64
64
  react_1.default.createElement("span", { className: "ffe-radio-input__content" }, children)),
65
65
  tooltip && react_1.default.createElement(Tooltip_1.Tooltip, __assign({}, tooltipProps), tooltip)));
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@sb1/ffe-form-react",
3
- "version": "20.1.1",
3
+ "version": "20.1.2",
4
4
  "description": "React component for form elements in ffe",
5
5
  "license": "MIT",
6
6
  "author": "SpareBank 1",
@@ -45,5 +45,5 @@
45
45
  "publishConfig": {
46
46
  "access": "public"
47
47
  },
48
- "gitHead": "d19672882758fd973c1a098ebfe2f829717ccd34"
48
+ "gitHead": "fac6e28e386cb36750482ed66c3774ceb359d9b9"
49
49
  }