dibk-design 6.1.0 → 6.2.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.
|
@@ -9,9 +9,16 @@ var _propTypes = _interopRequireDefault(require("prop-types"));
|
|
|
9
9
|
var _helpers = require("../functions/helpers");
|
|
10
10
|
var _asterisk = _interopRequireDefault(require("../assets/svg/asterisk.svg?url"));
|
|
11
11
|
var _CheckBoxListModule = _interopRequireDefault(require("./CheckBoxList.module.scss"));
|
|
12
|
+
var _Header = _interopRequireDefault(require("./Header"));
|
|
12
13
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
13
|
-
const CheckBoxList =
|
|
14
|
-
|
|
14
|
+
const CheckBoxList = _ref => {
|
|
15
|
+
let {
|
|
16
|
+
required,
|
|
17
|
+
compact,
|
|
18
|
+
legend,
|
|
19
|
+
legendSize,
|
|
20
|
+
children
|
|
21
|
+
} = _ref;
|
|
15
22
|
const renderChildElements = childElements => {
|
|
16
23
|
const childElementsthroughFragments = (0, _helpers.cloneThroughFragments)(childElements);
|
|
17
24
|
return childElementsthroughFragments.map((childElement, index) => {
|
|
@@ -19,8 +26,8 @@ const CheckBoxList = props => {
|
|
|
19
26
|
const isCheckBoxListItem = (childElement === null || childElement === void 0 || (_childElement$props = childElement.props) === null || _childElement$props === void 0 ? void 0 : _childElement$props.type) === "CheckBoxListItem";
|
|
20
27
|
if (isCheckBoxListItem) {
|
|
21
28
|
const childElementCopy = _react.default.cloneElement(childElement, {
|
|
22
|
-
requiredGroup:
|
|
23
|
-
compact:
|
|
29
|
+
requiredGroup: required,
|
|
30
|
+
compact: compact,
|
|
24
31
|
key: "checkboxListItem-".concat(index)
|
|
25
32
|
});
|
|
26
33
|
return childElementCopy;
|
|
@@ -31,14 +38,17 @@ const CheckBoxList = props => {
|
|
|
31
38
|
};
|
|
32
39
|
return _react.default.createElement("fieldset", {
|
|
33
40
|
className: _CheckBoxListModule.default.checkBoxList
|
|
34
|
-
}, !!(
|
|
41
|
+
}, !!(legend !== null && legend !== void 0 && legend.length) ? _react.default.createElement("legend", null, legendSize ? _react.default.createElement(_Header.default, {
|
|
42
|
+
size: legendSize
|
|
43
|
+
}, legend) : legend, required && _react.default.createElement("img", {
|
|
35
44
|
src: _asterisk.default,
|
|
36
45
|
alt: "",
|
|
37
46
|
className: _CheckBoxListModule.default.requiredSymbol
|
|
38
|
-
})) : null, renderChildElements(_react.default.Children.toArray(
|
|
47
|
+
})) : null, renderChildElements(_react.default.Children.toArray(children)));
|
|
39
48
|
};
|
|
40
49
|
CheckBoxList.propTypes = {
|
|
41
50
|
legend: _propTypes.default.string,
|
|
51
|
+
legendSize: _propTypes.default.oneOf([1, 2, 3, 4, 5]),
|
|
42
52
|
required: _propTypes.default.bool,
|
|
43
53
|
compact: _propTypes.default.bool
|
|
44
54
|
};
|
|
@@ -9,9 +9,16 @@ var _propTypes = _interopRequireDefault(require("prop-types"));
|
|
|
9
9
|
var _helpers = require("../functions/helpers");
|
|
10
10
|
var _asterisk = _interopRequireDefault(require("../assets/svg/asterisk.svg?url"));
|
|
11
11
|
var _RadioButtonListModule = _interopRequireDefault(require("./RadioButtonList.module.scss"));
|
|
12
|
+
var _Header = _interopRequireDefault(require("./Header"));
|
|
12
13
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
13
|
-
const RadioButtonList =
|
|
14
|
-
|
|
14
|
+
const RadioButtonList = _ref => {
|
|
15
|
+
let {
|
|
16
|
+
required,
|
|
17
|
+
compact,
|
|
18
|
+
legend,
|
|
19
|
+
legendSize,
|
|
20
|
+
children
|
|
21
|
+
} = _ref;
|
|
15
22
|
const renderChildElements = childElements => {
|
|
16
23
|
const childElementsthroughFragments = (0, _helpers.cloneThroughFragments)(childElements);
|
|
17
24
|
return childElementsthroughFragments.map((childElement, index) => {
|
|
@@ -19,8 +26,8 @@ const RadioButtonList = props => {
|
|
|
19
26
|
const isRadioButtonListItem = (childElement === null || childElement === void 0 || (_childElement$props = childElement.props) === null || _childElement$props === void 0 ? void 0 : _childElement$props.type) === "RadioButtonListItem";
|
|
20
27
|
if (isRadioButtonListItem) {
|
|
21
28
|
const childElementCopy = _react.default.cloneElement(childElement, {
|
|
22
|
-
requiredGroup:
|
|
23
|
-
compact:
|
|
29
|
+
requiredGroup: required,
|
|
30
|
+
compact: compact,
|
|
24
31
|
key: "radioButtonListItem-".concat(index)
|
|
25
32
|
});
|
|
26
33
|
return childElementCopy;
|
|
@@ -31,14 +38,17 @@ const RadioButtonList = props => {
|
|
|
31
38
|
};
|
|
32
39
|
return _react.default.createElement("fieldset", {
|
|
33
40
|
className: _RadioButtonListModule.default.radioButtonList
|
|
34
|
-
}, !!(
|
|
41
|
+
}, !!(legend !== null && legend !== void 0 && legend.length) ? _react.default.createElement("legend", null, legendSize ? _react.default.createElement(_Header.default, {
|
|
42
|
+
size: legendSize
|
|
43
|
+
}, legend) : legend, required && _react.default.createElement("img", {
|
|
35
44
|
src: _asterisk.default,
|
|
36
45
|
alt: "",
|
|
37
46
|
className: _RadioButtonListModule.default.requiredSymbol
|
|
38
|
-
})) : null, renderChildElements(_react.default.Children.toArray(
|
|
47
|
+
})) : null, renderChildElements(_react.default.Children.toArray(children)));
|
|
39
48
|
};
|
|
40
49
|
RadioButtonList.propTypes = {
|
|
41
50
|
legend: _propTypes.default.string,
|
|
51
|
+
legendSize: _propTypes.default.oneOf([1, 2, 3, 4, 5]),
|
|
42
52
|
required: _propTypes.default.bool,
|
|
43
53
|
compact: _propTypes.default.bool
|
|
44
54
|
};
|