oolib 2.175.2 → 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 (35) 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/Accordion/index.js +35 -8
  6. package/dist/v2/components/BarChart/comps/CustomTooltip/index.d.ts +1 -2
  7. package/dist/v2/components/BarChart/comps/CustomTooltip/index.js +5 -39
  8. package/dist/v2/components/BarChart/index.d.ts +1 -2
  9. package/dist/v2/components/BarChart/index.js +2 -2
  10. package/dist/v2/components/DataVizAccordion/index.js +4 -5
  11. package/dist/v2/components/RadioAndCheckbox/comps/CheckboxList/comps/CheckboxButton/index.d.ts +12 -0
  12. package/dist/v2/components/RadioAndCheckbox/comps/CheckboxList/comps/CheckboxButton/index.js +38 -0
  13. package/dist/v2/components/RadioAndCheckbox/comps/CheckboxList/comps/CheckboxButton/styled.d.ts +1 -0
  14. package/dist/v2/components/RadioAndCheckbox/comps/CheckboxList/comps/CheckboxButton/styled.js +69 -0
  15. package/dist/v2/components/RadioAndCheckbox/comps/CheckboxList/comps/CheckboxInput/index.d.ts +11 -0
  16. package/dist/v2/components/RadioAndCheckbox/comps/CheckboxList/comps/CheckboxInput/index.js +48 -0
  17. package/dist/v2/components/RadioAndCheckbox/comps/CheckboxList/index.d.ts +20 -0
  18. package/dist/v2/components/RadioAndCheckbox/comps/CheckboxList/index.js +124 -0
  19. package/dist/v2/components/RadioAndCheckbox/comps/CheckboxList/styled.d.ts +2 -0
  20. package/dist/v2/components/RadioAndCheckbox/comps/CheckboxList/styled.js +17 -0
  21. package/dist/v2/components/RadioAndCheckbox/comps/RadioList/comps/RadioInput/index.d.ts +18 -0
  22. package/dist/v2/components/RadioAndCheckbox/comps/RadioList/comps/RadioInput/index.js +53 -0
  23. package/dist/v2/components/RadioAndCheckbox/comps/RadioList/comps/RadioInput/styled.d.ts +1 -0
  24. package/dist/v2/components/RadioAndCheckbox/comps/RadioList/comps/RadioInput/styled.js +105 -0
  25. package/dist/v2/components/RadioAndCheckbox/comps/RadioList/comps/index.d.ts +1 -0
  26. package/dist/v2/components/RadioAndCheckbox/comps/RadioList/comps/index.js +6 -0
  27. package/dist/v2/components/RadioAndCheckbox/comps/RadioList/index.d.ts +17 -0
  28. package/dist/v2/components/RadioAndCheckbox/comps/RadioList/index.js +109 -0
  29. package/dist/v2/components/RadioAndCheckbox/index.d.ts +5 -0
  30. package/dist/v2/components/RadioAndCheckbox/index.js +14 -0
  31. package/dist/v2/components/RadioAndCheckbox/styled.d.ts +5 -0
  32. package/dist/v2/components/RadioAndCheckbox/styled.js +84 -0
  33. package/dist/v2/components/RadioAndCheckbox/utils.d.ts +22 -0
  34. package/dist/v2/components/RadioAndCheckbox/utils.js +49 -0
  35. package/package.json +1 -1
@@ -0,0 +1,260 @@
1
+ declare namespace _default {
2
+ let title: string;
3
+ }
4
+ export default _default;
5
+ export function RadioList(args: any): import("react").JSX.Element;
6
+ export namespace RadioList {
7
+ namespace args {
8
+ let size: string;
9
+ let listingStyle: string;
10
+ let optionsLimit: number;
11
+ let option1: string;
12
+ let option2: string;
13
+ let option3: string;
14
+ let option4: string;
15
+ let option5: string;
16
+ let addOther: boolean;
17
+ let markOptions: boolean;
18
+ let corrrectOption: string;
19
+ let feedbackMessage: string;
20
+ let saveValueAsString: boolean;
21
+ let disabled: boolean;
22
+ let readOnly: boolean;
23
+ let invert: boolean;
24
+ }
25
+ namespace argTypes {
26
+ export namespace corrrectOption_1 {
27
+ let name: string;
28
+ namespace control {
29
+ let type: string;
30
+ }
31
+ let options: string[];
32
+ }
33
+ export { corrrectOption_1 as corrrectOption };
34
+ export namespace size_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 namespace mapping {
45
+ let Small: string;
46
+ let Medium: string;
47
+ }
48
+ }
49
+ export { size_1 as size };
50
+ export namespace listingStyle_1 {
51
+ let name_2: string;
52
+ export { name_2 as name };
53
+ export namespace control_2 {
54
+ let type_2: string;
55
+ export { type_2 as type };
56
+ }
57
+ export { control_2 as control };
58
+ let options_2: string[];
59
+ export { options_2 as options };
60
+ }
61
+ export { listingStyle_1 as listingStyle };
62
+ export namespace disabled_1 {
63
+ let name_3: string;
64
+ export { name_3 as name };
65
+ }
66
+ export { disabled_1 as disabled };
67
+ export namespace invert_1 {
68
+ let name_4: string;
69
+ export { name_4 as name };
70
+ }
71
+ export { invert_1 as invert };
72
+ export namespace readOnly_1 {
73
+ let name_5: string;
74
+ export { name_5 as name };
75
+ }
76
+ export { readOnly_1 as readOnly };
77
+ export namespace optionsLimit_1 {
78
+ let name_6: string;
79
+ export { name_6 as name };
80
+ export namespace control_3 {
81
+ let type_3: string;
82
+ export { type_3 as type };
83
+ }
84
+ export { control_3 as control };
85
+ let options_3: number[];
86
+ export { options_3 as options };
87
+ }
88
+ export { optionsLimit_1 as optionsLimit };
89
+ export namespace saveValueAsString_1 {
90
+ let name_7: string;
91
+ export { name_7 as name };
92
+ }
93
+ export { saveValueAsString_1 as saveValueAsString };
94
+ export namespace feedbackMessage_1 {
95
+ let name_8: string;
96
+ export { name_8 as name };
97
+ }
98
+ export { feedbackMessage_1 as feedbackMessage };
99
+ export namespace markOptions_1 {
100
+ let name_9: string;
101
+ export { name_9 as name };
102
+ }
103
+ export { markOptions_1 as markOptions };
104
+ export namespace addOther_1 {
105
+ let name_10: string;
106
+ export { name_10 as name };
107
+ }
108
+ export { addOther_1 as addOther };
109
+ export namespace option1_1 {
110
+ let name_11: string;
111
+ export { name_11 as name };
112
+ export namespace control_4 {
113
+ let type_4: string;
114
+ export { type_4 as type };
115
+ }
116
+ export { control_4 as control };
117
+ }
118
+ export { option1_1 as option1 };
119
+ export namespace option2_1 {
120
+ let name_12: string;
121
+ export { name_12 as name };
122
+ export namespace control_5 {
123
+ let type_5: string;
124
+ export { type_5 as type };
125
+ }
126
+ export { control_5 as control };
127
+ }
128
+ export { option2_1 as option2 };
129
+ export namespace option3_1 {
130
+ let name_13: string;
131
+ export { name_13 as name };
132
+ export namespace control_6 {
133
+ let type_6: string;
134
+ export { type_6 as type };
135
+ }
136
+ export { control_6 as control };
137
+ }
138
+ export { option3_1 as option3 };
139
+ export namespace option4_1 {
140
+ let name_14: string;
141
+ export { name_14 as name };
142
+ export namespace control_7 {
143
+ let type_7: string;
144
+ export { type_7 as type };
145
+ }
146
+ export { control_7 as control };
147
+ }
148
+ export { option4_1 as option4 };
149
+ export namespace option5_1 {
150
+ let name_15: string;
151
+ export { name_15 as name };
152
+ export namespace control_8 {
153
+ let type_8: string;
154
+ export { type_8 as type };
155
+ }
156
+ export { control_8 as control };
157
+ }
158
+ export { option5_1 as option5 };
159
+ }
160
+ }
161
+ export function RadioInput(args: any): import("react").JSX.Element;
162
+ export namespace RadioInput {
163
+ export namespace args_1 {
164
+ let size_2: string;
165
+ export { size_2 as size };
166
+ let markOptions_2: boolean;
167
+ export { markOptions_2 as markOptions };
168
+ export let optionIsCorrect: boolean;
169
+ let disabled_2: boolean;
170
+ export { disabled_2 as disabled };
171
+ let invert_2: boolean;
172
+ export { invert_2 as invert };
173
+ }
174
+ export { args_1 as args };
175
+ export namespace argTypes_1 {
176
+ export namespace optionIsCorrect_1 {
177
+ let name_16: string;
178
+ export { name_16 as name };
179
+ }
180
+ export { optionIsCorrect_1 as optionIsCorrect };
181
+ export namespace size_3 {
182
+ let name_17: string;
183
+ export { name_17 as name };
184
+ export namespace control_9 {
185
+ let type_9: string;
186
+ export { type_9 as type };
187
+ }
188
+ export { control_9 as control };
189
+ let options_4: string[];
190
+ export { options_4 as options };
191
+ }
192
+ export { size_3 as size };
193
+ export namespace markOptions_3 {
194
+ let name_18: string;
195
+ export { name_18 as name };
196
+ }
197
+ export { markOptions_3 as markOptions };
198
+ export namespace disabled_3 {
199
+ let name_19: string;
200
+ export { name_19 as name };
201
+ }
202
+ export { disabled_3 as disabled };
203
+ export namespace invert_3 {
204
+ let name_20: string;
205
+ export { name_20 as name };
206
+ }
207
+ export { invert_3 as invert };
208
+ }
209
+ export { argTypes_1 as argTypes };
210
+ export namespace parameters {
211
+ namespace controls {
212
+ export { commonExcluded as exclude };
213
+ }
214
+ }
215
+ }
216
+ export function RadioButton(args: any): import("react").JSX.Element;
217
+ export namespace RadioButton {
218
+ export namespace args_2 {
219
+ let size_4: string;
220
+ export { size_4 as size };
221
+ let disabled_4: boolean;
222
+ export { disabled_4 as disabled };
223
+ let invert_4: boolean;
224
+ export { invert_4 as invert };
225
+ }
226
+ export { args_2 as args };
227
+ export namespace argTypes_2 {
228
+ export namespace size_5 {
229
+ let name_21: string;
230
+ export { name_21 as name };
231
+ export namespace control_10 {
232
+ let type_10: string;
233
+ export { type_10 as type };
234
+ }
235
+ export { control_10 as control };
236
+ let options_5: string[];
237
+ export { options_5 as options };
238
+ }
239
+ export { size_5 as size };
240
+ export namespace disabled_5 {
241
+ let name_22: string;
242
+ export { name_22 as name };
243
+ }
244
+ export { disabled_5 as disabled };
245
+ export namespace invert_5 {
246
+ let name_23: string;
247
+ export { name_23 as name };
248
+ }
249
+ export { invert_5 as invert };
250
+ }
251
+ export { argTypes_2 as argTypes };
252
+ export namespace parameters_1 {
253
+ export namespace controls_1 {
254
+ let exclude: string[];
255
+ }
256
+ export { controls_1 as controls };
257
+ }
258
+ export { parameters_1 as parameters };
259
+ }
260
+ declare const commonExcluded: string[];
@@ -0,0 +1,268 @@
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
+ Object.defineProperty(exports, "__esModule", { value: true });
26
+ exports.RadioButton = exports.RadioInput = exports.RadioList = void 0;
27
+ var react_1 = require("react");
28
+ var RadioAndCheckbox_1 = require("../../../v2/components/RadioAndCheckbox");
29
+ var react_json_view_1 = __importDefault(require("react-json-view"));
30
+ var Divider_1 = require("../../../v2/components/Divider");
31
+ var themes_1 = require("../../../v2/themes");
32
+ var greyColor100 = themes_1.colors.greyColor100;
33
+ var ops = [
34
+ { value: "op1", display: "Squidward" },
35
+ { value: "op2", display: "Mr krabs" },
36
+ { value: "op3", display: "Patric" },
37
+ { value: "op4", display: "SpongeBob SquarePants !!" },
38
+ { value: "op5", display: "Bob Marley" },
39
+ //{ value: 'other', display: "Other"},
40
+ ];
41
+ exports.default = {
42
+ title: "Oolib V 2.0/components/RadioButton",
43
+ };
44
+ var RadioList = function (args) {
45
+ var _a = (0, react_1.useState)(), chosenOption = _a[0], setChosenOption = _a[1];
46
+ var _b = (0, react_1.useState)(ops), options = _b[0], setOptions = _b[1];
47
+ (0, react_1.useEffect)(function () {
48
+ setOptions(options.map(function (op, idx) {
49
+ if (op.value === "other")
50
+ return op;
51
+ var argsText = args["option".concat(idx + 1)];
52
+ return argsText !== op.display ? __assign(__assign({}, op), { display: argsText }) : op;
53
+ }));
54
+ }, [args.option1, args.option2, args.option3, args.option4, args.option5]);
55
+ (0, react_1.useEffect)(function () {
56
+ if (args.markOptions) {
57
+ setOptions(options.map(function (op) {
58
+ if (op.value !== args.corrrectOption) {
59
+ return op.isCorrect ? __assign(__assign({}, op), { isCorrect: false }) : op;
60
+ }
61
+ return __assign(__assign({}, op), { isCorrect: true });
62
+ }));
63
+ }
64
+ }, [args.markOptions, args.corrrectOption]);
65
+ return (React.createElement("div", { style: { backgroundColor: args.invert && greyColor100, padding: "4rem" } },
66
+ React.createElement(RadioAndCheckbox_1.RadioList, { options: options, readOnly: args.readOnly, value: chosenOption, onChange: function (id, val) { return setChosenOption(val); }, rightWrongResult: args.markOptions, label: args.label, listType: args.listingStyle, injectOtherOption: args.addOther, disabled: args.disabled, invert: args.invert, S: args.size == "S", commonIsCorrectDesc: args.feedbackMessage, optionsLimit: args.optionsLimit, saveValueAsString: args.saveValueAsString }),
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: typeof chosenOption === "string"
75
+ ? { stringValue: chosenOption }
76
+ : chosenOption || {} }))));
77
+ };
78
+ exports.RadioList = RadioList;
79
+ exports.RadioList.args = {
80
+ size: "Medium",
81
+ listingStyle: "horizontal",
82
+ optionsLimit: ops.length,
83
+ // label: '',
84
+ option1: ops[0].display,
85
+ option2: ops[1].display,
86
+ option3: ops[2].display,
87
+ option4: ops[3].display,
88
+ option5: ops[4].display,
89
+ addOther: false,
90
+ markOptions: false,
91
+ corrrectOption: ops[3].value,
92
+ feedbackMessage: "this is correct because I chose so",
93
+ saveValueAsString: false,
94
+ disabled: false,
95
+ readOnly: false,
96
+ invert: false,
97
+ };
98
+ exports.RadioList.argTypes = {
99
+ corrrectOption: {
100
+ name: "Correct Option",
101
+ control: { type: "select" },
102
+ options: ops.map(function (op) { return op.value; }),
103
+ },
104
+ size: {
105
+ name: "Size",
106
+ control: { type: "select" },
107
+ options: ["Small", "Medium"],
108
+ mapping: {
109
+ Small: "S",
110
+ Medium: "M",
111
+ },
112
+ },
113
+ listingStyle: {
114
+ name: "Listing Style",
115
+ control: { type: "select" },
116
+ options: ["horizontal", "vertical"],
117
+ },
118
+ disabled: {
119
+ name: "Disabled",
120
+ },
121
+ invert: {
122
+ name: "Invert",
123
+ },
124
+ readOnly: {
125
+ name: "Read Only",
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
+ saveValueAsString: {
133
+ name: "Save Value as String",
134
+ },
135
+ feedbackMessage: {
136
+ name: "Feedback Message",
137
+ },
138
+ markOptions: {
139
+ name: "Mark Options",
140
+ },
141
+ addOther: {
142
+ name: "Add Other",
143
+ },
144
+ // label: {
145
+ // name: "Label",
146
+ // control: {type: 'text'},
147
+ // defaultValue: 'who lives in a pinapple under the sea?'
148
+ // },
149
+ option1: {
150
+ name: "option 1",
151
+ control: { type: "text" },
152
+ },
153
+ option2: {
154
+ name: "option 2",
155
+ control: { type: "text" },
156
+ },
157
+ option3: {
158
+ name: "option 3",
159
+ control: { type: "text" },
160
+ },
161
+ option4: {
162
+ name: "option 4",
163
+ control: { type: "text" },
164
+ },
165
+ option5: {
166
+ name: "option 5",
167
+ control: { type: "text" },
168
+ },
169
+ };
170
+ var RadioInput = function (args) {
171
+ var _a = (0, react_1.useState)(), value = _a[0], setValue = _a[1];
172
+ var _b = (0, react_1.useState)({ value: "smth", display: args.label }), option = _b[0], setOption = _b[1];
173
+ (0, react_1.useEffect)(function () {
174
+ setOption(__assign(__assign({}, option), { display: args.option1 }));
175
+ }, [args.option1]);
176
+ (0, react_1.useEffect)(function () {
177
+ setOption(__assign(__assign({}, option), { isCorrect: args.optionIsCorrect }));
178
+ }, [args.optionIsCorrect]);
179
+ return (React.createElement("div", { style: {
180
+ padding: "4rem",
181
+ backgroundColor: args.invert ? greyColor100 : "unset",
182
+ } },
183
+ React.createElement(RadioAndCheckbox_1.RadioInput, __assign({}, args, { value: value, option: option, S: args.size == "Small",
184
+ rightWrongResult: args.markOptions,
185
+ onClick: function (option) { return setValue(option); } }))));
186
+ };
187
+ exports.RadioInput = RadioInput;
188
+ exports.RadioInput.args = {
189
+ size: "Medium",
190
+ markOptions: false,
191
+ optionIsCorrect: false,
192
+ disabled: false,
193
+ invert: false,
194
+ };
195
+ exports.RadioInput.argTypes = {
196
+ optionIsCorrect: {
197
+ name: "Options is Correct",
198
+ },
199
+ // label: {
200
+ // name: "Text",
201
+ // control: {type: 'text'},
202
+ // },
203
+ size: {
204
+ // size
205
+ name: "Size",
206
+ control: { type: "inline-radio" },
207
+ options: ["Small", "Medium"],
208
+ },
209
+ markOptions: {
210
+ name: "Mark Options",
211
+ },
212
+ disabled: {
213
+ name: "Disabled",
214
+ },
215
+ invert: {
216
+ name: "Invert",
217
+ },
218
+ };
219
+ var RadioButton = function (args) {
220
+ var _a = (0, react_1.useState)(false), chosen = _a[0], setChosen = _a[1];
221
+ return (React.createElement("div", { style: {
222
+ padding: "4rem",
223
+ backgroundColor: args.invert ? greyColor100 : "unset",
224
+ } },
225
+ React.createElement(RadioAndCheckbox_1.RadioButton, __assign({}, args, { isSelected: chosen, onClick: function () { return setChosen(!chosen); }, S: args.size === "Small" }))));
226
+ };
227
+ exports.RadioButton = RadioButton;
228
+ exports.RadioButton.args = {
229
+ size: "Medium",
230
+ disabled: false,
231
+ invert: false,
232
+ };
233
+ exports.RadioButton.argTypes = {
234
+ size: {
235
+ // size
236
+ name: "Size",
237
+ control: { type: "inline-radio" },
238
+ options: ["Small", "Medium"],
239
+ },
240
+ disabled: {
241
+ name: "Disabled",
242
+ },
243
+ invert: {
244
+ name: "Invert",
245
+ },
246
+ };
247
+ var commonExcluded = [
248
+ "option2",
249
+ "option3",
250
+ "option4",
251
+ "option5",
252
+ "corrrectOption",
253
+ "listingStyle",
254
+ "label",
255
+ "feedbackMessage",
256
+ "optionsLimit",
257
+ "addOther",
258
+ "readOnly",
259
+ "saveValueAsString",
260
+ ];
261
+ exports.RadioInput.parameters = {
262
+ controls: { exclude: commonExcluded },
263
+ };
264
+ exports.RadioButton.parameters = {
265
+ controls: {
266
+ exclude: __spreadArray(__spreadArray([], commonExcluded, true), ["option1", "markOptions"], false),
267
+ },
268
+ };
@@ -52,7 +52,10 @@ var StyledContainer = styled_components_1.default.div(templateObject_1 || (templ
52
52
  var StyledHeader = styled_components_1.default.button(templateObject_2 || (templateObject_2 = __makeTemplateObject(["\n width: 100%;\n padding: 1rem 1.6rem;\n text-align: left;\n background: none;\n border: none;\n cursor: pointer;\n display: flex;\n align-items: center;\n"], ["\n width: 100%;\n padding: 1rem 1.6rem;\n text-align: left;\n background: none;\n border: none;\n cursor: pointer;\n display: flex;\n align-items: center;\n"])));
53
53
  var StyledRightHeaderSection = styled_components_1.default.div(templateObject_3 || (templateObject_3 = __makeTemplateObject(["\n display: flex;\n align-items: center;\n"], ["\n display: flex;\n align-items: center;\n"])));
54
54
  var ArrowWrapper = styled_components_1.default.button(templateObject_4 || (templateObject_4 = __makeTemplateObject(["\n border: none;\n background: none;\n cursor: pointer;\n width: 2rem;\n display: flex;\n align-items: center;\n justify-content: center;\n transform: rotate(", "deg);\n ", ";\n"], ["\n border: none;\n background: none;\n cursor: pointer;\n width: 2rem;\n display: flex;\n align-items: center;\n justify-content: center;\n transform: rotate(", "deg);\n ", ";\n"])), function (props) { return (props.isExpanded ? 0 : 180); }, (0, mixins_1.transition)("transform"));
55
- var StyledContentWrapper = styled_components_1.default.div(templateObject_5 || (templateObject_5 = __makeTemplateObject(["\n display: flex;\n align-items: flex-end;\n \n ", "\n height: ", ";\n"], ["\n display: flex;\n align-items: flex-end;\n \n ", "\n height: ", ";\n"])), (0, mixins_1.transition)("height"), function (_a) {
55
+ var StyledContentWrapper = styled_components_1.default.div(templateObject_5 || (templateObject_5 = __makeTemplateObject(["\n display: flex;\n align-items: flex-end;\n \n ", "\n height: ", ";\n"], ["\n display: flex;\n align-items: flex-end;\n \n ", "\n height: ", ";\n"])), function (_a) {
56
+ var expandAnimationDuration = _a.expandAnimationDuration;
57
+ return (0, mixins_1.transition)("height ".concat(expandAnimationDuration / 1000, "s ease-out"));
58
+ }, function (_a) {
56
59
  var height = _a.height;
57
60
  return height;
58
61
  });
@@ -88,9 +91,7 @@ var useCalculateWrapperHeight = function (_a) {
88
91
  });
89
92
  };
90
93
  var Accordion = function (_a) {
91
- var title = _a.title, children = _a.children, _b = _a.defaultExpanded, defaultExpanded = _b === void 0 ? true : _b, _c = _a.accordionOverflow, accordionOverflow = _c === void 0 ? 'hidden' : _c, //in some cases we need to toggle the overflow to let a tooltip stick out and show for example (in DataVizAccordion)
92
- _d = _a.actionsConfig, //in some cases we need to toggle the overflow to let a tooltip stick out and show for example (in DataVizAccordion)
93
- actionsConfig = _d === void 0 ? [
94
+ var title = _a.title, children = _a.children, _b = _a.defaultExpanded, defaultExpanded = _b === void 0 ? true : _b, _c = _a.actionsConfig, actionsConfig = _c === void 0 ? [
94
95
  {
95
96
  display: "Grouped",
96
97
  onClick: function () { return console.log("grouped"); },
@@ -99,9 +100,35 @@ var Accordion = function (_a) {
99
100
  display: "Stacked",
100
101
  onClick: function () { return console.log("stacked"); },
101
102
  },
102
- ] : _d;
103
- var _e = (0, react_1.useState)(defaultExpanded), isExpanded = _e[0], setIsExpanded = _e[1];
104
- var _f = useCalculateWrapperHeight({ isExpanded: isExpanded }), wrapperRef = _f.wrapperRef, wrapperHeight = _f.wrapperHeight;
103
+ ] : _c;
104
+ var _d = (0, react_1.useState)(defaultExpanded), isExpanded = _d[0], setIsExpanded = _d[1];
105
+ var _e = useCalculateWrapperHeight({ isExpanded: isExpanded }), wrapperRef = _e.wrapperRef, wrapperHeight = _e.wrapperHeight;
106
+ var expandAnimationDuration = 300;
107
+ //helps to make the accordionOverflow visible once its open,
108
+ //for scenarios where a data viz tooltip needs to stick out
109
+ var _f = (0, react_1.useState)("hidden"), accordionOverflow = _f[0], setAccordionOverflow = _f[1];
110
+ (0, react_1.useEffect)(function () {
111
+ var timeoutId;
112
+ if (isExpanded) {
113
+ // Set timeout for making content visible after animation
114
+ timeoutId = setTimeout(function () {
115
+ // Double check if still expanded before setting to visible
116
+ if (isExpanded) {
117
+ setAccordionOverflow("visible");
118
+ }
119
+ }, expandAnimationDuration);
120
+ }
121
+ else {
122
+ // Immediately set to hidden when closing
123
+ setAccordionOverflow("hidden");
124
+ }
125
+ // Cleanup function to clear timeout if component updates/unmounts
126
+ return function () {
127
+ if (timeoutId) {
128
+ clearTimeout(timeoutId);
129
+ }
130
+ };
131
+ }, [isExpanded, expandAnimationDuration]);
105
132
  return (react_1.default.createElement(StyledContainer, null,
106
133
  react_1.default.createElement(StyledHeader, { onClick: function () { return setIsExpanded(!isExpanded); } },
107
134
  react_1.default.createElement("div", { style: { flex: "1 0 0" } },
@@ -110,7 +137,7 @@ var Accordion = function (_a) {
110
137
  react_1.default.createElement(ArrowWrapper, { isExpanded: isExpanded },
111
138
  react_1.default.createElement(phosphor_react_1.CaretDown, { size: 16 })),
112
139
  actionsConfig && (react_1.default.createElement(ActionMenu_1.ActionMenu, { CustomSelectComp: CustomActionMenuSelectButton, actions: actionsConfig })))),
113
- react_1.default.createElement(StyledContentWrapper, { height: wrapperHeight, style: { overflow: accordionOverflow } },
140
+ react_1.default.createElement(StyledContentWrapper, { height: wrapperHeight, style: { overflow: accordionOverflow }, expandAnimationDuration: expandAnimationDuration },
114
141
  react_1.default.createElement(StyledContentInnerWrapper, { ref: wrapperRef }, children))));
115
142
  };
116
143
  exports.Accordion = Accordion;
@@ -1,10 +1,9 @@
1
- import React, { Dispatch, SetStateAction } from 'react';
1
+ import React from 'react';
2
2
  import { TooltipProps } from 'recharts';
3
3
  import { LabelData } from '../CustomizedLabel';
4
4
  interface CustomTooltipProps extends TooltipProps<number, string> {
5
5
  value?: LabelData[];
6
6
  showPercent?: boolean;
7
- setAccordionOverflow?: Dispatch<SetStateAction<string>>;
8
7
  }
9
8
  declare const CustomTooltip: React.FC<CustomTooltipProps>;
10
9
  export default CustomTooltip;
@@ -1,44 +1,14 @@
1
1
  "use strict";
2
- var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
- if (k2 === undefined) k2 = k;
4
- var desc = Object.getOwnPropertyDescriptor(m, k);
5
- if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
- desc = { enumerable: true, get: function() { return m[k]; } };
7
- }
8
- Object.defineProperty(o, k2, desc);
9
- }) : (function(o, m, k, k2) {
10
- if (k2 === undefined) k2 = k;
11
- o[k2] = m[k];
12
- }));
13
- var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
14
- Object.defineProperty(o, "default", { enumerable: true, value: v });
15
- }) : function(o, v) {
16
- o["default"] = v;
17
- });
18
- var __importStar = (this && this.__importStar) || (function () {
19
- var ownKeys = function(o) {
20
- ownKeys = Object.getOwnPropertyNames || function (o) {
21
- var ar = [];
22
- for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
23
- return ar;
24
- };
25
- return ownKeys(o);
26
- };
27
- return function (mod) {
28
- if (mod && mod.__esModule) return mod;
29
- var result = {};
30
- if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
31
- __setModuleDefault(result, mod);
32
- return result;
33
- };
34
- })();
2
+ var __importDefault = (this && this.__importDefault) || function (mod) {
3
+ return (mod && mod.__esModule) ? mod : { "default": mod };
4
+ };
35
5
  Object.defineProperty(exports, "__esModule", { value: true });
36
- var react_1 = __importStar(require("react"));
6
+ var react_1 = __importDefault(require("react"));
37
7
  var Typo2_1 = require("../../../Typo2");
38
8
  var __1 = require("../../../../..");
39
9
  var CustomTooltip = function (props) {
40
10
  var _a, _b;
41
- var active = props.active, payload = props.payload, value = props.value, showPercent = props.showPercent, setAccordionOverflow = props.setAccordionOverflow;
11
+ var active = props.active, payload = props.payload, value = props.value, showPercent = props.showPercent;
42
12
  if (!active || !payload || !payload.length)
43
13
  return null;
44
14
  // Calculate position - align with the right side of the bars
@@ -59,10 +29,6 @@ var CustomTooltip = function (props) {
59
29
  flexDirection: 'column',
60
30
  gap: '0.5rem'
61
31
  };
62
- (0, react_1.useEffect)(function () {
63
- setAccordionOverflow && setAccordionOverflow('visible');
64
- return function () { return setAccordionOverflow && setAccordionOverflow('hidden'); };
65
- }, []);
66
32
  return (react_1.default.createElement("div", { style: style }, value.map(function (entry, index) { return (react_1.default.createElement("div", { key: index, style: {
67
33
  display: 'flex',
68
34
  alignItems: 'center',
@@ -1,4 +1,4 @@
1
- import React, { Dispatch, SetStateAction } from "react";
1
+ import React from "react";
2
2
  export interface BaseConfigs {
3
3
  barHeight: number;
4
4
  labelToBarGap: number;
@@ -29,6 +29,5 @@ export interface BarChartProps {
29
29
  showPercent?: boolean;
30
30
  breakdownDisplayType?: "grouped" | "stacked";
31
31
  colorIdx?: number;
32
- setAccordionOverflow?: Dispatch<SetStateAction<string>>;
33
32
  }
34
33
  export declare const BarChart: React.FC<BarChartProps>;