oolib 2.175.3 → 2.175.4

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.
Files changed (29) hide show
  1. package/dist/stories/v2/components/Checkbox.stories.d.ts +252 -0
  2. package/dist/stories/v2/components/Checkbox.stories.js +252 -0
  3. package/dist/stories/v2/components/RadioButton.stories.d.ts +260 -0
  4. package/dist/stories/v2/components/RadioButton.stories.js +268 -0
  5. package/dist/v2/components/RadioAndCheckbox/comps/CheckboxList/comps/CheckboxButton/index.d.ts +12 -0
  6. package/dist/v2/components/RadioAndCheckbox/comps/CheckboxList/comps/CheckboxButton/index.js +38 -0
  7. package/dist/v2/components/RadioAndCheckbox/comps/CheckboxList/comps/CheckboxButton/styled.d.ts +1 -0
  8. package/dist/v2/components/RadioAndCheckbox/comps/CheckboxList/comps/CheckboxButton/styled.js +69 -0
  9. package/dist/v2/components/RadioAndCheckbox/comps/CheckboxList/comps/CheckboxInput/index.d.ts +11 -0
  10. package/dist/v2/components/RadioAndCheckbox/comps/CheckboxList/comps/CheckboxInput/index.js +48 -0
  11. package/dist/v2/components/RadioAndCheckbox/comps/CheckboxList/index.d.ts +20 -0
  12. package/dist/v2/components/RadioAndCheckbox/comps/CheckboxList/index.js +124 -0
  13. package/dist/v2/components/RadioAndCheckbox/comps/CheckboxList/styled.d.ts +2 -0
  14. package/dist/v2/components/RadioAndCheckbox/comps/CheckboxList/styled.js +17 -0
  15. package/dist/v2/components/RadioAndCheckbox/comps/RadioList/comps/RadioInput/index.d.ts +18 -0
  16. package/dist/v2/components/RadioAndCheckbox/comps/RadioList/comps/RadioInput/index.js +53 -0
  17. package/dist/v2/components/RadioAndCheckbox/comps/RadioList/comps/RadioInput/styled.d.ts +1 -0
  18. package/dist/v2/components/RadioAndCheckbox/comps/RadioList/comps/RadioInput/styled.js +105 -0
  19. package/dist/v2/components/RadioAndCheckbox/comps/RadioList/comps/index.d.ts +1 -0
  20. package/dist/v2/components/RadioAndCheckbox/comps/RadioList/comps/index.js +6 -0
  21. package/dist/v2/components/RadioAndCheckbox/comps/RadioList/index.d.ts +17 -0
  22. package/dist/v2/components/RadioAndCheckbox/comps/RadioList/index.js +109 -0
  23. package/dist/v2/components/RadioAndCheckbox/index.d.ts +5 -0
  24. package/dist/v2/components/RadioAndCheckbox/index.js +14 -0
  25. package/dist/v2/components/RadioAndCheckbox/styled.d.ts +5 -0
  26. package/dist/v2/components/RadioAndCheckbox/styled.js +84 -0
  27. package/dist/v2/components/RadioAndCheckbox/utils.d.ts +22 -0
  28. package/dist/v2/components/RadioAndCheckbox/utils.js +49 -0
  29. package/package.json +1 -1
@@ -0,0 +1,252 @@
1
+ declare namespace _default {
2
+ let title: string;
3
+ }
4
+ export default _default;
5
+ export function CheckboxList(args: any): import("react").JSX.Element;
6
+ export namespace CheckboxList {
7
+ namespace args {
8
+ let inputStyle: string;
9
+ let size: string;
10
+ let listingStyle: string;
11
+ let addOther: boolean;
12
+ let optionsLimit: number;
13
+ let option1: string;
14
+ let option2: string;
15
+ let option3: string;
16
+ let option4: string;
17
+ let option5: string;
18
+ let markOptions: boolean;
19
+ let correctOptions: string;
20
+ let feedbackMessage: string;
21
+ let disabled: boolean;
22
+ let readOnly: boolean;
23
+ let invert: boolean;
24
+ }
25
+ namespace argTypes {
26
+ export namespace correctOptions_1 {
27
+ let name: string;
28
+ namespace control {
29
+ let type: string;
30
+ }
31
+ let options: string[];
32
+ }
33
+ export { correctOptions_1 as correctOptions };
34
+ export namespace inputStyle_1 {
35
+ let name_1: string;
36
+ export { name_1 as name };
37
+ export namespace control_1 {
38
+ let type_1: string;
39
+ export { type_1 as type };
40
+ }
41
+ export { control_1 as control };
42
+ let options_1: string[];
43
+ export { options_1 as options };
44
+ export let mapping: {
45
+ "Tag select": string;
46
+ Checkbox: string;
47
+ };
48
+ }
49
+ export { inputStyle_1 as inputStyle };
50
+ export namespace addOther_1 {
51
+ let name_2: string;
52
+ export { name_2 as name };
53
+ }
54
+ export { addOther_1 as addOther };
55
+ export namespace size_1 {
56
+ let name_3: string;
57
+ export { name_3 as name };
58
+ export namespace control_2 {
59
+ let type_2: string;
60
+ export { type_2 as type };
61
+ }
62
+ export { control_2 as control };
63
+ let options_2: string[];
64
+ export { options_2 as options };
65
+ export namespace mapping_1 {
66
+ let Small: string;
67
+ let Medium: string;
68
+ }
69
+ export { mapping_1 as mapping };
70
+ }
71
+ export { size_1 as size };
72
+ export namespace listingStyle_1 {
73
+ let name_4: string;
74
+ export { name_4 as name };
75
+ export namespace control_3 {
76
+ let type_3: string;
77
+ export { type_3 as type };
78
+ }
79
+ export { control_3 as control };
80
+ let options_3: string[];
81
+ export { options_3 as options };
82
+ }
83
+ export { listingStyle_1 as listingStyle };
84
+ export namespace optionsLimit_1 {
85
+ let name_5: string;
86
+ export { name_5 as name };
87
+ export namespace control_4 {
88
+ let type_4: string;
89
+ export { type_4 as type };
90
+ }
91
+ export { control_4 as control };
92
+ let options_4: number[];
93
+ export { options_4 as options };
94
+ }
95
+ export { optionsLimit_1 as optionsLimit };
96
+ export namespace feedbackMessage_1 {
97
+ let name_6: string;
98
+ export { name_6 as name };
99
+ export namespace control_5 {
100
+ let type_5: string;
101
+ export { type_5 as type };
102
+ }
103
+ export { control_5 as control };
104
+ }
105
+ export { feedbackMessage_1 as feedbackMessage };
106
+ export namespace option1_1 {
107
+ let name_7: string;
108
+ export { name_7 as name };
109
+ export namespace control_6 {
110
+ let type_6: string;
111
+ export { type_6 as type };
112
+ }
113
+ export { control_6 as control };
114
+ }
115
+ export { option1_1 as option1 };
116
+ export namespace option2_1 {
117
+ let name_8: string;
118
+ export { name_8 as name };
119
+ export namespace control_7 {
120
+ let type_7: string;
121
+ export { type_7 as type };
122
+ }
123
+ export { control_7 as control };
124
+ }
125
+ export { option2_1 as option2 };
126
+ export namespace option3_1 {
127
+ let name_9: string;
128
+ export { name_9 as name };
129
+ export namespace control_8 {
130
+ let type_8: string;
131
+ export { type_8 as type };
132
+ }
133
+ export { control_8 as control };
134
+ }
135
+ export { option3_1 as option3 };
136
+ export namespace option4_1 {
137
+ let name_10: string;
138
+ export { name_10 as name };
139
+ export namespace control_9 {
140
+ let type_9: string;
141
+ export { type_9 as type };
142
+ }
143
+ export { control_9 as control };
144
+ }
145
+ export { option4_1 as option4 };
146
+ export namespace option5_1 {
147
+ let name_11: string;
148
+ export { name_11 as name };
149
+ export namespace control_10 {
150
+ let type_10: string;
151
+ export { type_10 as type };
152
+ }
153
+ export { control_10 as control };
154
+ }
155
+ export { option5_1 as option5 };
156
+ export namespace markOptions_1 {
157
+ let name_12: string;
158
+ export { name_12 as name };
159
+ }
160
+ export { markOptions_1 as markOptions };
161
+ export namespace disabled_1 {
162
+ let name_13: string;
163
+ export { name_13 as name };
164
+ }
165
+ export { disabled_1 as disabled };
166
+ export namespace readOnly_1 {
167
+ let name_14: string;
168
+ export { name_14 as name };
169
+ }
170
+ export { readOnly_1 as readOnly };
171
+ export namespace invert_1 {
172
+ let name_15: string;
173
+ export { name_15 as name };
174
+ }
175
+ export { invert_1 as invert };
176
+ }
177
+ }
178
+ export function CheckboxInput(args: any): import("react").JSX.Element;
179
+ export namespace CheckboxInput {
180
+ export namespace args_1 {
181
+ let inputStyle_2: string;
182
+ export { inputStyle_2 as inputStyle };
183
+ let option1_2: string;
184
+ export { option1_2 as option1 };
185
+ let markOptions_2: boolean;
186
+ export { markOptions_2 as markOptions };
187
+ export let optionIsCorrect: boolean;
188
+ let invert_2: boolean;
189
+ export { invert_2 as invert };
190
+ }
191
+ export { args_1 as args };
192
+ export namespace argTypes_1 {
193
+ export namespace optionIsCorrect_1 {
194
+ let name_16: string;
195
+ export { name_16 as name };
196
+ }
197
+ export { optionIsCorrect_1 as optionIsCorrect };
198
+ export namespace option1_3 {
199
+ let name_17: string;
200
+ export { name_17 as name };
201
+ }
202
+ export { option1_3 as option1 };
203
+ export namespace markOptions_3 {
204
+ let name_18: string;
205
+ export { name_18 as name };
206
+ }
207
+ export { markOptions_3 as markOptions };
208
+ export namespace inputStyle_3 {
209
+ let name_19: string;
210
+ export { name_19 as name };
211
+ export namespace control_11 {
212
+ let type_11: string;
213
+ export { type_11 as type };
214
+ }
215
+ export { control_11 as control };
216
+ let options_5: string[];
217
+ export { options_5 as options };
218
+ let mapping_2: {
219
+ "Tag select": string;
220
+ Checkbox: string;
221
+ };
222
+ export { mapping_2 as mapping };
223
+ }
224
+ export { inputStyle_3 as inputStyle };
225
+ export namespace invert_3 {
226
+ let name_20: string;
227
+ export { name_20 as name };
228
+ }
229
+ export { invert_3 as invert };
230
+ }
231
+ export { argTypes_1 as argTypes };
232
+ export namespace parameters {
233
+ namespace controls {
234
+ export { commonExcluded as exclude };
235
+ }
236
+ }
237
+ }
238
+ export function CheckboxButton(args: any): import("react").JSX.Element;
239
+ export namespace CheckboxButton {
240
+ export namespace args_2 {
241
+ let isMixture: boolean;
242
+ }
243
+ export { args_2 as args };
244
+ export namespace parameters_1 {
245
+ export namespace controls_1 {
246
+ let exclude: string[];
247
+ }
248
+ export { controls_1 as controls };
249
+ }
250
+ export { parameters_1 as parameters };
251
+ }
252
+ declare const commonExcluded: string[];
@@ -0,0 +1,252 @@
1
+ "use strict";
2
+ var __assign = (this && this.__assign) || function () {
3
+ __assign = Object.assign || function(t) {
4
+ for (var s, i = 1, n = arguments.length; i < n; i++) {
5
+ s = arguments[i];
6
+ for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
7
+ t[p] = s[p];
8
+ }
9
+ return t;
10
+ };
11
+ return __assign.apply(this, arguments);
12
+ };
13
+ var __spreadArray = (this && this.__spreadArray) || function (to, from, pack) {
14
+ if (pack || arguments.length === 2) for (var i = 0, l = from.length, ar; i < l; i++) {
15
+ if (ar || !(i in from)) {
16
+ if (!ar) ar = Array.prototype.slice.call(from, 0, i);
17
+ ar[i] = from[i];
18
+ }
19
+ }
20
+ return to.concat(ar || Array.prototype.slice.call(from));
21
+ };
22
+ var __importDefault = (this && this.__importDefault) || function (mod) {
23
+ return (mod && mod.__esModule) ? mod : { "default": mod };
24
+ };
25
+ var _a, _b;
26
+ Object.defineProperty(exports, "__esModule", { value: true });
27
+ exports.CheckboxButton = exports.CheckboxInput = exports.CheckboxList = void 0;
28
+ var react_1 = require("react");
29
+ var RadioAndCheckbox_1 = require("../../../v2/components/RadioAndCheckbox");
30
+ var react_json_view_1 = __importDefault(require("react-json-view"));
31
+ var Divider_1 = require("../../../v2/components/Divider");
32
+ var themes_1 = require("../../../v2/themes");
33
+ var greyColor100 = themes_1.colors.greyColor100;
34
+ var ops = [
35
+ { value: "op1", display: "Squidward" },
36
+ { value: "op2", display: "Mohammed Ali" },
37
+ { value: "op3", display: "Patric" },
38
+ { value: "op4", display: "Mr krabs" },
39
+ { value: "op5", display: "Bob Marley" },
40
+ //{ value: 'other', display: "Other"},
41
+ ];
42
+ exports.default = {
43
+ title: "Oolib V 2.0/components/Checkbox",
44
+ };
45
+ var CheckboxList = function (args) {
46
+ var _a = (0, react_1.useState)([]), selectedOptions = _a[0], setSelectedOptions = _a[1];
47
+ var _b = (0, react_1.useState)(ops), options = _b[0], setOptions = _b[1];
48
+ (0, react_1.useEffect)(function () {
49
+ setOptions(options.map(function (op, idx) {
50
+ var argsText = args["option".concat(idx + 1)];
51
+ return argsText !== op.display ? __assign(__assign({}, op), { display: argsText }) : op;
52
+ }));
53
+ }, [args.option1, args.option2, args.option3, args.option4, args.option5]);
54
+ (0, react_1.useEffect)(function () {
55
+ setOptions(options.map(function (op) {
56
+ var userIncluded = args.correctOptions.includes(op.value);
57
+ if (op.isCorrect) {
58
+ return userIncluded ? op : __assign(__assign({}, op), { isCorrect: false });
59
+ }
60
+ else {
61
+ return userIncluded ? __assign(__assign({}, op), { isCorrect: true }) : op;
62
+ }
63
+ }));
64
+ }, [args.correctOptions]);
65
+ return (React.createElement("div", { style: { backgroundColor: args.invert && greyColor100, padding: '4rem' } },
66
+ React.createElement(RadioAndCheckbox_1.CheckboxList, { options: options, value: selectedOptions, onChange: function (id, val) { return setSelectedOptions(val); }, rightWrongResult: args.markOptions, listType: args.listingStyle, injectOtherOption: args.addOther, commonIsCorrectDesc: args.feedbackMessage, S: args.size == "S", readOnly: args.readOnly, label: args.label, disabled: args.disabled, invert: args.invert, inputStyle: args.inputStyle, optionsLimit: args.optionsLimit }),
67
+ React.createElement("br", null),
68
+ " ",
69
+ React.createElement(Divider_1.Divider, null),
70
+ " ",
71
+ React.createElement("br", null),
72
+ React.createElement("details", { style: { margin: "2rem 0" } },
73
+ React.createElement("summary", { style: { fontSize: "1.4rem", marginBottom: 10 } }, "Dev only area"),
74
+ React.createElement(react_json_view_1.default, { theme: "monokai", displayDataTypes: false, style: { fontSize: "1.3rem" }, name: "Value", src: selectedOptions }))));
75
+ };
76
+ exports.CheckboxList = CheckboxList;
77
+ exports.CheckboxList.args = {
78
+ inputStyle: "Checkbox",
79
+ size: "Medium",
80
+ listingStyle: "horizontal",
81
+ addOther: false,
82
+ optionsLimit: ops.length,
83
+ option1: ops[0].display,
84
+ option2: ops[1].display,
85
+ option3: ops[2].display,
86
+ option4: ops[3].display,
87
+ option5: ops[4].display,
88
+ markOptions: false,
89
+ correctOptions: ops[3].value,
90
+ feedbackMessage: "Answer is shown, have a look",
91
+ disabled: false,
92
+ readOnly: false,
93
+ invert: false,
94
+ };
95
+ exports.CheckboxList.argTypes = {
96
+ correctOptions: {
97
+ name: "Correct Options",
98
+ control: { type: "inline-check" },
99
+ options: ops.map(function (op) { return op.value; }),
100
+ },
101
+ inputStyle: {
102
+ name: "Checkbox Type",
103
+ control: { type: "select" },
104
+ options: ["Checkbox", "Tag select"],
105
+ mapping: (_a = {},
106
+ _a["Tag select"] = "tagSelect",
107
+ _a.Checkbox = "checkbox",
108
+ _a),
109
+ },
110
+ addOther: {
111
+ name: "Add Other Option",
112
+ },
113
+ size: {
114
+ name: "Checkbox Size",
115
+ control: { type: "inline-radio" },
116
+ options: ["Small", "Medium"],
117
+ mapping: {
118
+ Small: "S",
119
+ Medium: "M",
120
+ },
121
+ },
122
+ listingStyle: {
123
+ name: "Listing Style",
124
+ control: { type: "select" },
125
+ options: ["horizontal", "vertical"],
126
+ },
127
+ optionsLimit: {
128
+ name: "Options Limit",
129
+ control: { type: "select" },
130
+ options: Array.from({ length: ops.length + 1 }, function (_, index) { return index; }),
131
+ },
132
+ feedbackMessage: {
133
+ name: "Feedback Message",
134
+ control: { type: "text" },
135
+ },
136
+ // label: {
137
+ // control: { type: "text" },
138
+ // },
139
+ option1: {
140
+ name: "Option 1",
141
+ control: { type: "text" },
142
+ },
143
+ option2: {
144
+ name: "Option 2",
145
+ control: { type: "text" },
146
+ },
147
+ option3: {
148
+ name: "Option 3",
149
+ control: { type: "text" },
150
+ },
151
+ option4: {
152
+ name: "Option 4",
153
+ control: { type: "text" },
154
+ },
155
+ option5: {
156
+ name: "Option 5",
157
+ control: { type: "text" },
158
+ },
159
+ markOptions: {
160
+ name: "Mark Options",
161
+ },
162
+ disabled: {
163
+ name: "Disabled",
164
+ },
165
+ readOnly: {
166
+ name: "ReadOnly",
167
+ },
168
+ invert: {
169
+ name: "Invert",
170
+ },
171
+ };
172
+ var CheckboxInput = function (args) {
173
+ var _a = (0, react_1.useState)([]), value = _a[0], setValue = _a[1];
174
+ var _b = (0, react_1.useState)({ value: "smth", display: "Squidward" }), option = _b[0], setOption = _b[1];
175
+ (0, react_1.useEffect)(function () {
176
+ setOption(__assign(__assign({}, option), { display: args.option1 }));
177
+ }, [args.option1]);
178
+ (0, react_1.useEffect)(function () {
179
+ setOption(__assign(__assign({}, option), { isCorrect: args.optionIsCorrect }));
180
+ }, [args.optionIsCorrect]);
181
+ return (React.createElement("div", { style: {
182
+ padding: "4rem",
183
+ backgroundColor: args.invert ? greyColor100 : "unset",
184
+ } },
185
+ React.createElement(RadioAndCheckbox_1.CheckboxInput, __assign({}, args, { value: value, option: option, S: args.size == "S",
186
+ rightWrongResult: args.markOptions,
187
+ onClick: function (isSelected, option) { return setValue(isSelected ? [] : [option]); } }))));
188
+ };
189
+ exports.CheckboxInput = CheckboxInput;
190
+ var CheckboxButton = function (args) {
191
+ var _a = (0, react_1.useState)(false), chosen = _a[0], setChosen = _a[1];
192
+ return (React.createElement("div", { style: {
193
+ padding: "4rem",
194
+ backgroundColor: args.invert ? greyColor100 : "unset",
195
+ } },
196
+ React.createElement(RadioAndCheckbox_1.CheckboxButton, __assign({}, args, { isSelected: chosen, onChange: function (k, v) { return setChosen(v); }, S: args.size === "S" }))));
197
+ };
198
+ exports.CheckboxButton = CheckboxButton;
199
+ exports.CheckboxButton.args = {
200
+ isMixture: true
201
+ };
202
+ var commonExcluded = [
203
+ "option2",
204
+ "option3",
205
+ "option4",
206
+ "option5",
207
+ "correctOptions",
208
+ "listingStyle",
209
+ "label",
210
+ "feedbackMessage",
211
+ "optionsLimit",
212
+ "addOther",
213
+ "readOnly",
214
+ ];
215
+ exports.CheckboxInput.args = {
216
+ inputStyle: 'Checkbox',
217
+ option1: ops[0].display,
218
+ markOptions: false,
219
+ optionIsCorrect: false,
220
+ invert: false
221
+ };
222
+ exports.CheckboxInput.argTypes = {
223
+ optionIsCorrect: {
224
+ name: 'Option is Correct'
225
+ },
226
+ option1: {
227
+ name: 'Option 1'
228
+ },
229
+ markOptions: {
230
+ name: "Mark Options"
231
+ },
232
+ inputStyle: {
233
+ name: "Checkbox Type",
234
+ control: { type: "select" },
235
+ options: ["Checkbox", "Tag select"],
236
+ mapping: (_b = {},
237
+ _b["Tag select"] = "tagSelect",
238
+ _b.Checkbox = "checkbox",
239
+ _b),
240
+ },
241
+ invert: {
242
+ name: "Invert",
243
+ },
244
+ };
245
+ exports.CheckboxInput.parameters = {
246
+ controls: { exclude: commonExcluded },
247
+ };
248
+ exports.CheckboxButton.parameters = {
249
+ controls: {
250
+ exclude: __spreadArray(__spreadArray([], commonExcluded, true), ["option1", "markOptions", "inputStyle"], false),
251
+ },
252
+ };