oolib 2.128.1 → 2.128.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.
@@ -1,9 +1,10 @@
1
1
  export default RadioListMultiQuestion;
2
- declare function RadioListMultiQuestion({ options, subQuestionLabels, onChange, value, readOnly }: {
2
+ declare function RadioListMultiQuestion({ options, subQuestionLabels, onChange, value, readOnly, id }: {
3
3
  options: any;
4
4
  subQuestionLabels: any;
5
5
  onChange: any;
6
6
  value: any;
7
7
  readOnly: any;
8
+ id: any;
8
9
  }, ...args: any[]): React.JSX.Element;
9
10
  import React from 'react';
@@ -43,16 +43,13 @@ var themes_1 = require("../../themes");
43
43
  var getBlockLabelProps_1 = require("../../utils/getBlockLabelProps");
44
44
  var greyColor10 = themes_1.colors.greyColor10;
45
45
  function RadioListMultiQuestion(_a) {
46
- var options = _a.options, subQuestionLabels = _a.subQuestionLabels, onChange = _a.onChange, value = _a.value, readOnly = _a.readOnly;
47
- // const [ value, setValue ] = useState(_value);
46
+ var options = _a.options, subQuestionLabels = _a.subQuestionLabels, onChange = _a.onChange, value = _a.value, readOnly = _a.readOnly, id = _a.id;
48
47
  var props = arguments[0];
49
48
  var handleChange = function (subQuestionValue, option) {
50
49
  // const key = `${label.trim().replaceAll(' ','').toLowerCase()}.${subQuestionValue}`
50
+ var _a;
51
51
  var display = option.display, optionValue = option.value;
52
- onChange(function (prevValue) {
53
- var _a;
54
- return (__assign(__assign({}, prevValue), (_a = {}, _a[subQuestionValue] = { display: display, value: optionValue }, _a)));
55
- });
52
+ onChange(id, __assign(__assign({}, value), (_a = {}, _a[subQuestionValue] = { display: display, value: optionValue }, _a)));
56
53
  };
57
54
  return (react_1.default.createElement("div", null,
58
55
  react_1.default.createElement(BlockLabel_1.BlockLabel, __assign({}, (0, getBlockLabelProps_1.getBlockLabelProps)(props))),
@@ -72,7 +69,11 @@ function RadioListMultiQuestion(_a) {
72
69
  var _a;
73
70
  return (react_1.default.createElement("td", { key: "".concat(subQuestion === null || subQuestion === void 0 ? void 0 : subQuestion.value, "-").concat(option === null || option === void 0 ? void 0 : option.value), style: { borderLeft: "1px solid ".concat(greyColor10) } },
74
71
  react_1.default.createElement(styled_1.StyledElem, null,
75
- react_1.default.createElement(RadioAndCheckbox_1.RadioButton, { isSelected: value[subQuestion === null || subQuestion === void 0 ? void 0 : subQuestion.value] && ((_a = value[subQuestion === null || subQuestion === void 0 ? void 0 : subQuestion.value]) === null || _a === void 0 ? void 0 : _a.value) === (option === null || option === void 0 ? void 0 : option.value), onClick: function () { return !readOnly && handleChange(subQuestion === null || subQuestion === void 0 ? void 0 : subQuestion.value, option); } }))));
72
+ react_1.default.createElement(RadioAndCheckbox_1.RadioButton, { isSelected: (!readOnly &&
73
+ value &&
74
+ (subQuestion === null || subQuestion === void 0 ? void 0 : subQuestion.value) &&
75
+ ((_a = value[subQuestion.value]) === null || _a === void 0 ? void 0 : _a.value) === (option === null || option === void 0 ? void 0 : option.value)) ||
76
+ false, onClick: function () { return !readOnly && handleChange(subQuestion === null || subQuestion === void 0 ? void 0 : subQuestion.value, option); } }))));
76
77
  }))); })))));
77
78
  }
78
79
  ;
@@ -33,6 +33,6 @@ var _RadioListMultiQuestion = function (args) {
33
33
  { display: 'Sometimes', value: 'sometimes' },
34
34
  { display: 'Often', value: 'often' },
35
35
  { display: 'Always', value: 'always' },
36
- ], sublabel: "Select all that apply", value: value, onChange: function (d) { return setValue(d); }, readOnly: args.readOnly })));
36
+ ], sublabel: "Select all that apply", value: value, onChange: function (id, value) { return setValue(value); }, readOnly: args.readOnly })));
37
37
  };
38
38
  exports._RadioListMultiQuestion = _RadioListMultiQuestion;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "oolib",
3
- "version": "2.128.1",
3
+ "version": "2.128.2",
4
4
  "description": " OKE Component Library",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",