oolib 2.129.0 → 2.129.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.
@@ -0,0 +1,13 @@
1
+ export default GroupQuestionsInputSingle;
2
+ declare function GroupQuestionsInputSingle({ options, subQuestionLabels, onChange, value, readOnly, id, questionColWidth, radioColsWidth, variant: _variant }: {
3
+ options: any;
4
+ subQuestionLabels: any;
5
+ onChange: any;
6
+ value: any;
7
+ readOnly: any;
8
+ id: any;
9
+ questionColWidth?: number;
10
+ radioColsWidth?: number;
11
+ variant?: string;
12
+ }, ...args: any[]): React.JSX.Element;
13
+ import React from "react";
@@ -41,9 +41,16 @@ var styled_1 = require("./styled");
41
41
  var BlockLabel_1 = require("../BlockLabel");
42
42
  var themes_1 = require("../../themes");
43
43
  var getBlockLabelProps_1 = require("../../utils/getBlockLabelProps");
44
+ var _EXPORTS_1 = require("../../utils/_EXPORTS");
45
+ var mixins_1 = require("../../themes/mixins");
46
+ var DropdownSingle_1 = require("../Dropdowns/DropdownSingle");
44
47
  var greyColor10 = themes_1.colors.greyColor10;
45
- function RadioListMultiQuestion(_a) {
46
- var options = _a.options, subQuestionLabels = _a.subQuestionLabels, onChange = _a.onChange, value = _a.value, readOnly = _a.readOnly, id = _a.id;
48
+ function GroupQuestionsInputSingle(_a) {
49
+ var options = _a.options, subQuestionLabels = _a.subQuestionLabels, onChange = _a.onChange, value = _a.value, readOnly = _a.readOnly, id = _a.id, _b = _a.questionColWidth, questionColWidth = _b === void 0 ? 200 : _b, _c = _a.radioColsWidth, radioColsWidth = _c === void 0 ? 120 : _c, _d = _a.variant, _variant = _d === void 0 ? 'radio' : _d;
50
+ var screenWidth = (0, _EXPORTS_1.useScreenWidth)();
51
+ var variant = (screenWidth < (0, mixins_1.getBreakPoint)("sm") || _variant === 'dropdown')
52
+ ? 'dropdown'
53
+ : 'radio';
47
54
  var props = arguments[0];
48
55
  var handleChange = function (subQuestionValue, option) {
49
56
  // const key = `${label.trim().replaceAll(' ','').toLowerCase()}.${subQuestionValue}`
@@ -53,12 +60,19 @@ function RadioListMultiQuestion(_a) {
53
60
  };
54
61
  return (react_1.default.createElement("div", null,
55
62
  react_1.default.createElement(BlockLabel_1.BlockLabel, __assign({}, (0, getBlockLabelProps_1.getBlockLabelProps)(props))),
56
- react_1.default.createElement(styled_1.StyledTable, null,
63
+ react_1.default.createElement("div", { style: { overflowX: "auto", overflowY: "hidden" } }, variant === 'radio' ? (react_1.default.createElement(styled_1.StyledTable, null,
57
64
  react_1.default.createElement("thead", null,
58
65
  react_1.default.createElement("tr", null,
59
- react_1.default.createElement("th", { style: { borderBottom: "1px solid ".concat(greyColor10) } }),
60
- " ", options === null || options === void 0 ? void 0 :
61
- options.map(function (option) { return (react_1.default.createElement(styled_1.StyledTableTh, { key: option === null || option === void 0 ? void 0 : option.value },
66
+ react_1.default.createElement("th", { style: {
67
+ width: "".concat(questionColWidth, "px"),
68
+ minWidth: "".concat(questionColWidth, "px"),
69
+ borderBottom: "1px solid ".concat(greyColor10),
70
+ } }),
71
+ " ", options === null || options === void 0 ? void 0 :
72
+ options.map(function (option) { return (react_1.default.createElement(styled_1.StyledTableTh, { style: {
73
+ width: "".concat(radioColsWidth, "px"),
74
+ minWidth: "".concat(radioColsWidth, "px"),
75
+ }, key: option === null || option === void 0 ? void 0 : option.value },
62
76
  react_1.default.createElement(styled_1.StyledElem, null,
63
77
  react_1.default.createElement(Typo_1.SANS_3, { semibold: true }, option === null || option === void 0 ? void 0 : option.display)))); }))),
64
78
  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 },
@@ -71,9 +85,16 @@ function RadioListMultiQuestion(_a) {
71
85
  react_1.default.createElement(styled_1.StyledElem, null,
72
86
  react_1.default.createElement(RadioAndCheckbox_1.RadioButton, { isSelected: (value &&
73
87
  (subQuestion === null || subQuestion === void 0 ? void 0 : subQuestion.value) &&
74
- ((_a = value[subQuestion.value]) === null || _a === void 0 ? void 0 : _a.value) === (option === null || option === void 0 ? void 0 : option.value)) ||
75
- false, onClick: function () { return !readOnly && handleChange(subQuestion === null || subQuestion === void 0 ? void 0 : subQuestion.value, option); } }))));
76
- }))); })))));
88
+ ((_a = value[subQuestion.value]) === null || _a === void 0 ? void 0 : _a.value) ===
89
+ (option === null || option === void 0 ? void 0 : option.value)) ||
90
+ false, onClick: function () {
91
+ return !readOnly &&
92
+ handleChange(subQuestion === null || subQuestion === void 0 ? void 0 : subQuestion.value, option);
93
+ } }))));
94
+ }))); })))) : (react_1.default.createElement("div", { style: { display: 'flex', flexDirection: 'column', gap: '2rem' } }, subQuestionLabels.map(function (subQuestion) { return (react_1.default.createElement("div", null,
95
+ react_1.default.createElement(Typo_1.SANS_2, { semibold: true, style: { paddingBottom: "1rem" } }, subQuestion.display),
96
+ react_1.default.createElement(DropdownSingle_1.DropdownSingle, { options: options, value: value && value[subQuestion.value], onChange: function (k, v) {
97
+ handleChange(subQuestion.value, v);
98
+ } }))); }))))));
77
99
  }
78
- ;
79
- exports.default = RadioListMultiQuestion;
100
+ exports.default = GroupQuestionsInputSingle;
package/dist/index.d.ts CHANGED
@@ -63,7 +63,7 @@ export { default as AudioInput } from "./components/AudioInput";
63
63
  export { default as PDFInput } from "./components/PDFInput";
64
64
  export { default as IFrameInput } from "./components/IFrameInput";
65
65
  export { ResourceInput } from "./components/ResourceInput";
66
- export { default as RadioListMultiQuestion } from "./components/RadioListMultiQuestion";
66
+ export { default as GroupQuestionsInputSingle } from "./components/GroupQuestionsInputSingle";
67
67
  export { ModalConfirmAction } from "./components/Modals/derivedComps/ModalConfirmAction";
68
68
  export { SimpleTable } from "./components/SimpleTable";
69
69
  export { styledOKELinkCSS } from "./components/OKELink/styled";
package/dist/index.js CHANGED
@@ -18,7 +18,7 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
18
18
  };
19
19
  Object.defineProperty(exports, "__esModule", { value: true });
20
20
  exports.PDFInput = exports.AudioInput = exports.VideoInput = exports.ProfileImageInput = exports.ImageInput = exports.MetaBlock = exports.HintsProvider = exports.genTagComp = exports.generateOptions = exports.OptionsSingle = exports.DropdownMulti = exports.DropdownSingle = exports.parseCardConfig = exports.ListProfile = exports.CardProfile = exports.CardEmbed = exports.ListContent = exports.CardContent = exports.DateTimeRangePicker = exports.DateTimePicker = exports.TimeRangePicker = exports.TimePicker = exports.DateRangePicker = exports.DatePicker = exports.TextLoader = exports.BarChart = exports.PageScrollIndicator = exports.HomeCover = exports.EmptyStates = exports.ModalSmall = exports.Modal = exports.ModalForms = exports.ModalConfirm = exports.SkeletonLoader = exports.Divider = exports.PercentBarChart = exports.PercentCompletedPie = exports.Accordion = exports.ActionMenu = exports.Tooltip = exports.OKELink = exports.UserRoleBadge = exports.Section = exports.LoaderOverlay = exports.Loader = exports.ProgressBar = exports.LoaderCircle = exports.icons = exports.colors = exports.GlobalStyles = void 0;
21
- exports.TableCellResizerPlugin = exports.styledOKELinkCSS = exports.SimpleTable = exports.ModalConfirmAction = exports.BannerProvider = exports.useBannerContext = exports.BannerContext = exports.BannerInfo = exports.BannerAlert = exports.RadioListMultiQuestion = exports.ResourceInput = exports.IFrameInput = void 0;
21
+ exports.TableCellResizerPlugin = exports.styledOKELinkCSS = exports.SimpleTable = exports.ModalConfirmAction = exports.BannerProvider = exports.useBannerContext = exports.BannerContext = exports.BannerInfo = exports.BannerAlert = exports.GroupQuestionsInputSingle = exports.ResourceInput = exports.IFrameInput = void 0;
22
22
  //css and styling related ( styled-components )
23
23
  var globalStyles_1 = require("./globalStyles");
24
24
  Object.defineProperty(exports, "GlobalStyles", { enumerable: true, get: function () { return globalStyles_1.GlobalStyles; } });
@@ -153,8 +153,8 @@ var IFrameInput_1 = require("./components/IFrameInput");
153
153
  Object.defineProperty(exports, "IFrameInput", { enumerable: true, get: function () { return __importDefault(IFrameInput_1).default; } });
154
154
  var ResourceInput_1 = require("./components/ResourceInput");
155
155
  Object.defineProperty(exports, "ResourceInput", { enumerable: true, get: function () { return ResourceInput_1.ResourceInput; } });
156
- var RadioListMultiQuestion_1 = require("./components/RadioListMultiQuestion");
157
- Object.defineProperty(exports, "RadioListMultiQuestion", { enumerable: true, get: function () { return __importDefault(RadioListMultiQuestion_1).default; } });
156
+ var GroupQuestionsInputSingle_1 = require("./components/GroupQuestionsInputSingle");
157
+ Object.defineProperty(exports, "GroupQuestionsInputSingle", { enumerable: true, get: function () { return __importDefault(GroupQuestionsInputSingle_1).default; } });
158
158
  //banners
159
159
  var Banners_1 = require("./components/Banners");
160
160
  Object.defineProperty(exports, "BannerAlert", { enumerable: true, get: function () { return Banners_1.BannerAlert; } });
@@ -9,4 +9,4 @@ declare namespace _default {
9
9
  let args: {};
10
10
  }
11
11
  export default _default;
12
- export function _RadioListMultiQuestion(args: any): import("react").JSX.Element;
12
+ export function _GroupQuestionsInputSingle(args: any): import("react").JSX.Element;
@@ -0,0 +1,38 @@
1
+ "use strict";
2
+ var __importDefault = (this && this.__importDefault) || function (mod) {
3
+ return (mod && mod.__esModule) ? mod : { "default": mod };
4
+ };
5
+ Object.defineProperty(exports, "__esModule", { value: true });
6
+ exports._GroupQuestionsInputSingle = void 0;
7
+ var react_1 = require("react");
8
+ var GroupQuestionsInputSingle_1 = __importDefault(require("../components/GroupQuestionsInputSingle"));
9
+ var themes_1 = require("../themes");
10
+ exports.default = {
11
+ title: "Components/GroupQuestionsInputSingle",
12
+ argTypes: {
13
+ readOnly: {
14
+ name: "Read Only",
15
+ type: "boolean"
16
+ },
17
+ },
18
+ args: {}
19
+ };
20
+ var _GroupQuestionsInputSingle = function (args) {
21
+ var _a = (0, react_1.useState)({}), value = _a[0], setValue = _a[1];
22
+ console.log({ valueParent: value });
23
+ return (React.createElement("div", { style: { background: args.invert ? themes_1.colors.greyColor100 : '' } },
24
+ React.createElement(GroupQuestionsInputSingle_1.default, { label: "When shopping online, how often do you do each of the following?", subQuestionLabels: [
25
+ { display: 'Visit multiple websites Visit multiple websites', value: 'visit_multiple_websites' },
26
+ { display: 'Read customer reviews Read customer reviews ', value: 'read_customer_reviews' },
27
+ { display: 'Watch a video demonstration Watch a video demonstration', value: 'watch_video_demo' },
28
+ { display: 'Check the delivery date Check the delivery date', value: 'check_delivery_date' },
29
+ { display: 'Check for payment options Check for payment options', value: 'check_payment_options' },
30
+ ], options: [
31
+ { display: 'Never Never Never Never ', value: 'never' },
32
+ { display: 'Rarely Rarely Rarely Rarely ', value: 'rarely' },
33
+ { display: 'Sometimes Sometimes Sometimes Sometimes ', value: 'sometimes' },
34
+ { display: 'Often Often Often Often ', value: 'often' },
35
+ { display: 'Always Always Always Always ', value: 'always' },
36
+ ], sublabel: "Select all that apply", value: value, onChange: function (id, value) { return setValue(value); }, readOnly: args.readOnly })));
37
+ };
38
+ exports._GroupQuestionsInputSingle = _GroupQuestionsInputSingle;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "oolib",
3
- "version": "2.129.0",
3
+ "version": "2.129.2",
4
4
  "description": " OKE Component Library",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",
@@ -1,10 +0,0 @@
1
- export default RadioListMultiQuestion;
2
- declare function RadioListMultiQuestion({ options, subQuestionLabels, onChange, value, readOnly, id }: {
3
- options: any;
4
- subQuestionLabels: any;
5
- onChange: any;
6
- value: any;
7
- readOnly: any;
8
- id: any;
9
- }, ...args: any[]): React.JSX.Element;
10
- import React from 'react';
@@ -1,38 +0,0 @@
1
- "use strict";
2
- var __importDefault = (this && this.__importDefault) || function (mod) {
3
- return (mod && mod.__esModule) ? mod : { "default": mod };
4
- };
5
- Object.defineProperty(exports, "__esModule", { value: true });
6
- exports._RadioListMultiQuestion = void 0;
7
- var react_1 = require("react");
8
- var RadioListMultiQuestion_1 = __importDefault(require("../components/RadioListMultiQuestion"));
9
- var themes_1 = require("../themes");
10
- exports.default = {
11
- title: "Components/RadioListMultiQuestion",
12
- argTypes: {
13
- readOnly: {
14
- name: "Read Only",
15
- type: "boolean"
16
- },
17
- },
18
- args: {}
19
- };
20
- var _RadioListMultiQuestion = function (args) {
21
- var _a = (0, react_1.useState)({}), value = _a[0], setValue = _a[1];
22
- console.log({ valueParent: value });
23
- return (React.createElement("div", { style: { background: args.invert ? themes_1.colors.greyColor100 : '' } },
24
- React.createElement(RadioListMultiQuestion_1.default, { label: "When shopping online, how often do you do each of the following?", subQuestionLabels: [
25
- { display: 'Visit multiple websites', value: 'visit_multiple_websites' },
26
- { display: 'Read customer reviews', value: 'read_customer_reviews' },
27
- { display: 'Watch a video demonstration', value: 'watch_video_demo' },
28
- { display: 'Check the delivery date', value: 'check_delivery_date' },
29
- { display: 'Check for payment options', value: 'check_payment_options' },
30
- ], options: [
31
- { display: 'Never', value: 'never' },
32
- { display: 'Rarely', value: 'rarely' },
33
- { display: 'Sometimes', value: 'sometimes' },
34
- { display: 'Often', value: 'often' },
35
- { display: 'Always', value: 'always' },
36
- ], sublabel: "Select all that apply", value: value, onChange: function (id, value) { return setValue(value); }, readOnly: args.readOnly })));
37
- };
38
- exports._RadioListMultiQuestion = _RadioListMultiQuestion;