@sb1/ffe-form-react 20.1.0 → 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.
- package/es/BaseRadioButton.js +2 -2
- package/es/InputGroup.js +0 -2
- package/lib/BaseRadioButton.js +2 -2
- package/lib/InputGroup.js +0 -2
- package/package.json +2 -2
- package/types/InputGroup.d.ts +0 -1
package/es/BaseRadioButton.js
CHANGED
|
@@ -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)));
|
package/es/InputGroup.js
CHANGED
|
@@ -74,7 +74,6 @@ export var InputGroup = function (_a) {
|
|
|
74
74
|
id: id,
|
|
75
75
|
'aria-invalid': isInvalid ? 'true' : 'false',
|
|
76
76
|
'aria-describedby': ariaDescribedBy,
|
|
77
|
-
onColoredBg: onColoredBg,
|
|
78
77
|
};
|
|
79
78
|
var modifiedChildren = getChildrenWithExtraProps(children, extraProps);
|
|
80
79
|
return (React.createElement("div", __assign({ className: classNames('ffe-input-group', {
|
|
@@ -97,6 +96,5 @@ export var InputGroup = function (_a) {
|
|
|
97
96
|
React.isValidElement(fieldMessage) &&
|
|
98
97
|
React.cloneElement(fieldMessage, {
|
|
99
98
|
id: fieldMessageId,
|
|
100
|
-
onColoredBg: onColoredBg,
|
|
101
99
|
})));
|
|
102
100
|
};
|
package/lib/BaseRadioButton.js
CHANGED
|
@@ -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/lib/InputGroup.js
CHANGED
|
@@ -103,7 +103,6 @@ var InputGroup = function (_a) {
|
|
|
103
103
|
id: id,
|
|
104
104
|
'aria-invalid': isInvalid ? 'true' : 'false',
|
|
105
105
|
'aria-describedby': ariaDescribedBy,
|
|
106
|
-
onColoredBg: onColoredBg,
|
|
107
106
|
};
|
|
108
107
|
var modifiedChildren = getChildrenWithExtraProps(children, extraProps);
|
|
109
108
|
return (react_1.default.createElement("div", __assign({ className: (0, classnames_1.default)('ffe-input-group', {
|
|
@@ -126,7 +125,6 @@ var InputGroup = function (_a) {
|
|
|
126
125
|
react_1.default.isValidElement(fieldMessage) &&
|
|
127
126
|
react_1.default.cloneElement(fieldMessage, {
|
|
128
127
|
id: fieldMessageId,
|
|
129
|
-
onColoredBg: onColoredBg,
|
|
130
128
|
})));
|
|
131
129
|
};
|
|
132
130
|
exports.InputGroup = InputGroup;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@sb1/ffe-form-react",
|
|
3
|
-
"version": "20.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": "
|
|
48
|
+
"gitHead": "fac6e28e386cb36750482ed66c3774ceb359d9b9"
|
|
49
49
|
}
|
package/types/InputGroup.d.ts
CHANGED
|
@@ -4,7 +4,6 @@ type ChildrenExtraProps = {
|
|
|
4
4
|
id: string;
|
|
5
5
|
'aria-invalid': 'true' | 'false';
|
|
6
6
|
'aria-describedby': string | undefined;
|
|
7
|
-
onColoredBg?: boolean;
|
|
8
7
|
};
|
|
9
8
|
export interface InputGroupProps extends Omit<React.ComponentPropsWithoutRef<'div'>, 'children'> {
|
|
10
9
|
/** The id that will be used on the input child if you don't want a generated one */
|