oolib 2.126.0 → 2.127.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.
@@ -1,9 +1,11 @@
1
1
  export default RadioListMultiQuestion;
2
- declare function RadioListMultiQuestion({ label, options, subQuestionLabels, onChange, value: _value }: {
2
+ declare function RadioListMultiQuestion({ label, sublabel, options, subQuestionLabels, onChange, value: _value, readOnly }: {
3
3
  label: any;
4
+ sublabel: any;
4
5
  options: any;
5
6
  subQuestionLabels: any;
6
7
  onChange: any;
7
8
  value: any;
9
+ readOnly: any;
8
10
  }): React.JSX.Element;
9
11
  import React from 'react';
@@ -42,7 +42,7 @@ var BlockLabel_1 = require("../BlockLabel");
42
42
  var themes_1 = require("../../themes");
43
43
  var greyColor10 = themes_1.colors.greyColor10;
44
44
  var RadioListMultiQuestion = function (_a) {
45
- var label = _a.label, options = _a.options, subQuestionLabels = _a.subQuestionLabels, onChange = _a.onChange, _value = _a.value;
45
+ var label = _a.label, sublabel = _a.sublabel, options = _a.options, subQuestionLabels = _a.subQuestionLabels, onChange = _a.onChange, _value = _a.value, readOnly = _a.readOnly;
46
46
  var _b = (0, react_1.useState)(_value), value = _b[0], setValue = _b[1];
47
47
  var handleChange = function (subQuestionValue, option) {
48
48
  // const key = `${label.trim().replaceAll(' ','').toLowerCase()}.${subQuestionValue}`
@@ -54,24 +54,24 @@ var RadioListMultiQuestion = function (_a) {
54
54
  onChange(value);
55
55
  };
56
56
  return (react_1.default.createElement("div", null,
57
- react_1.default.createElement(BlockLabel_1.BlockLabel, { label: label }),
57
+ react_1.default.createElement(BlockLabel_1.BlockLabel, { label: label, sublabel: sublabel }),
58
58
  react_1.default.createElement(styled_1.StyledTable, null,
59
59
  react_1.default.createElement("thead", null,
60
60
  react_1.default.createElement("tr", null,
61
61
  react_1.default.createElement("th", { style: { borderBottom: "1px solid ".concat(greyColor10) } }),
62
- " ",
63
- options.map(function (option) { return (react_1.default.createElement(styled_1.StyledTableTh, { key: option.value },
62
+ " ", options === null || options === void 0 ? void 0 :
63
+ options.map(function (option) { return (react_1.default.createElement(styled_1.StyledTableTh, { key: option === null || option === void 0 ? void 0 : option.value },
64
64
  react_1.default.createElement(styled_1.StyledElem, null,
65
- react_1.default.createElement(Typo_1.SANS_3, { semibold: true }, option.display)))); }))),
66
- react_1.default.createElement("tbody", null, subQuestionLabels.map(function (subQuestion, i) { return (react_1.default.createElement(styled_1.StyledTableRow, { key: subQuestion.value, index: i },
65
+ react_1.default.createElement(Typo_1.SANS_3, { semibold: true }, option === null || option === void 0 ? void 0 : option.display)))); }))),
66
+ react_1.default.createElement("tbody", null, subQuestionLabels === null || subQuestionLabels === void 0 ? void 0 : subQuestionLabels.map(function (subQuestion, i) { return (react_1.default.createElement(styled_1.StyledTableRow, { key: subQuestion === null || subQuestion === void 0 ? void 0 : subQuestion.value, index: i },
67
67
  react_1.default.createElement("td", null,
68
68
  react_1.default.createElement("div", { style: { padding: "1rem" } },
69
- react_1.default.createElement(Typo_1.SANS_3, { semibold: true }, subQuestion.display))),
69
+ react_1.default.createElement(Typo_1.SANS_3, { semibold: true }, subQuestion === null || subQuestion === void 0 ? void 0 : subQuestion.display))), options === null || options === void 0 ? void 0 :
70
70
  options.map(function (option, i) {
71
71
  var _a;
72
72
  return (react_1.default.createElement("td", { key: option.value, style: { borderLeft: "1px solid ".concat(greyColor10) } },
73
73
  react_1.default.createElement(styled_1.StyledElem, null,
74
- react_1.default.createElement(RadioAndCheckbox_1.RadioButton, { isSelected: ((_a = value[subQuestion === null || subQuestion === void 0 ? void 0 : subQuestion.value]) === null || _a === void 0 ? void 0 : _a.value) === option.value, onClick: function () { return handleChange(subQuestion.value, option); } }))));
74
+ react_1.default.createElement(RadioAndCheckbox_1.RadioButton, { isSelected: ((_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); } }))));
75
75
  }))); })))));
76
76
  };
77
77
  exports.default = RadioListMultiQuestion;
@@ -1,6 +1,11 @@
1
1
  declare namespace _default {
2
2
  let title: string;
3
- let argTypes: {};
3
+ namespace argTypes {
4
+ namespace readOnly {
5
+ let name: string;
6
+ let type: string;
7
+ }
8
+ }
4
9
  let args: {};
5
10
  }
6
11
  export default _default;
@@ -9,7 +9,12 @@ var RadioListMultiQuestion_1 = __importDefault(require("../components/RadioListM
9
9
  var themes_1 = require("../themes");
10
10
  exports.default = {
11
11
  title: "Components/RadioListMultiQuestion",
12
- argTypes: {},
12
+ argTypes: {
13
+ readOnly: {
14
+ name: "Read Only",
15
+ type: "boolean"
16
+ },
17
+ },
13
18
  args: {}
14
19
  };
15
20
  var _RadioListMultiQuestion = function (args) {
@@ -28,6 +33,6 @@ var _RadioListMultiQuestion = function (args) {
28
33
  { display: 'Sometimes', value: 'sometimes' },
29
34
  { display: 'Often', value: 'often' },
30
35
  { display: 'Always', value: 'always' },
31
- ], value: value, onChange: function (d) { return setValue(d); } })));
36
+ ], value: value, onChange: function (d) { return setValue(d); }, readOnly: args.readOnly })));
32
37
  };
33
38
  exports._RadioListMultiQuestion = _RadioListMultiQuestion;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "oolib",
3
- "version": "2.126.0",
3
+ "version": "2.127.1",
4
4
  "description": " OKE Component Library",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",