oolib 2.168.1 → 2.168.3
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.
- package/dist/components/Dropdowns/comps/OptionsShell/index.js +1 -1
- package/dist/components/Dropdowns/comps/OptionsSingle/index.js +2 -3
- package/dist/components/Modals/Modal/comps/ModalHeaderStyle1/index.d.ts +2 -1
- package/dist/components/Modals/Modal/comps/ModalHeaderStyle1/index.js +2 -2
- package/dist/components/Modals/Modal/index.d.ts +3 -0
- package/dist/components/Modals/Modal/index.js +4 -3
- package/dist/components/Modals/Modal/styled.d.ts +1 -0
- package/dist/components/Modals/Modal/styled.js +4 -1
- package/dist/stories/v2/components/TabBar.stories.js +2 -2
- package/dist/v2/components/TabBar/index.js +11 -1
- package/package.json +3 -4
- package/dist/components/Dropdowns/comps/VirtualizedWrapper/index.d.ts +0 -7
- package/dist/components/Dropdowns/comps/VirtualizedWrapper/index.js +0 -66
- package/dist/components/Dropdowns/comps/VirtualizedWrapper/styled.d.ts +0 -1
- package/dist/components/Dropdowns/comps/VirtualizedWrapper/styled.js +0 -45
|
@@ -56,7 +56,7 @@ exports.OptionsShell = react_1.default.forwardRef(function (_a, ref) {
|
|
|
56
56
|
position: "absolute",
|
|
57
57
|
bottom: yOrientation === "top" ? undefined : 0,
|
|
58
58
|
top: yOrientation === "top" ? 0 : undefined,
|
|
59
|
-
} }, children)))) : (react_1.default.createElement(framer_motion_1.AnimatePresence, null, showOptions ? (react_1.default.createElement(Modal_1.Modal, { fitToContentHeight: true, title: optionsModalLabel || label, onClose: handleHideOptions, invert: invert, S: S },
|
|
59
|
+
} }, children)))) : (react_1.default.createElement(framer_motion_1.AnimatePresence, null, showOptions ? (react_1.default.createElement(Modal_1.Modal, { fitToContentHeight: true, title: optionsModalLabel || label, onClose: handleHideOptions, invert: invert, S: S, dynamicHeaderHeight: true },
|
|
60
60
|
SelectComp && SelectComp,
|
|
61
61
|
react_1.default.createElement(styled_1.StyledModalOptionsWrapper, { invert: invert, ref: ref }, children),
|
|
62
62
|
showDoneButton && (react_1.default.createElement("div", { style: {
|
|
@@ -35,7 +35,6 @@ var TextInputs_1 = require("../../../TextInputs");
|
|
|
35
35
|
var TextLoader_1 = require("../../../LoadersAndProgress/TextLoader");
|
|
36
36
|
var useKeyboardControl_1 = require("../../utils/useKeyboardControl");
|
|
37
37
|
var useSetYOrientation_1 = require("../../utils/useSetYOrientation");
|
|
38
|
-
var VirtualizedWrapper_1 = require("../VirtualizedWrapper");
|
|
39
38
|
/**
|
|
40
39
|
* if used independently, must be used inside a 'position: relative/absolute' div.
|
|
41
40
|
*/
|
|
@@ -84,13 +83,13 @@ var OptionsSingle = function (_a) {
|
|
|
84
83
|
return (react_1.default.createElement(react_1.default.Fragment, null,
|
|
85
84
|
react_1.default.createElement(OptionsShell_1.OptionsShell, { ref: optionsRef, yOrientation: yOrientation, lightboxHeight: lightboxHeight, lightboxStyle: lightboxStyle, options: options, optionsAnchor: optionsAnchor, showOptions: showOptions, SelectComp: SelectComp, handleHideOptions: handleHideOptions, label: label, optionsModalLabel: optionsModalLabel, invert: invert, relativeToRef: relativeToRef, popOutOfOverflowHiddenParent: popOutOfOverflowHiddenParent, alignDropdown: alignDropdown, S: S },
|
|
86
85
|
isSearchable && genSearchBar(),
|
|
87
|
-
options.length === 0 ? (react_1.default.createElement(NoOptionResultsComp_1.NoOptionResultsComp, { S: S })) : (react_1.default.createElement(
|
|
86
|
+
options.length === 0 ? (react_1.default.createElement(NoOptionResultsComp_1.NoOptionResultsComp, { S: S })) : (react_1.default.createElement(react_1.Fragment, null, options.map(function (option, index) { return (react_1.default.createElement(styled_1.StyledOption, { key: option.value, invert: invert, isSelected: !option.loading && (value === null || value === void 0 ? void 0 : value.value) === option.value, isFocussed: focussedOp === index, className: "OKE-Dropdown__option", ref: function (el) {
|
|
88
87
|
return focussedOp === index && el && scrollFocussedOpIntoView(el);
|
|
89
88
|
}, onClick: function (e) {
|
|
90
89
|
if (!option.loading)
|
|
91
90
|
handleSelect(option);
|
|
92
91
|
setSearchString && setSearchString("");
|
|
93
|
-
}, S: S
|
|
92
|
+
}, S: S }, option.loading ? (react_1.default.createElement(TextLoader_1.TextLoader, { style: { width: "8rem", height: "1.5rem" } })) : (react_1.default.createElement(OptionContent_1.OptionContent, { option: option, optionsClassName: optionsClassName, invert: invert, S: S, observerRef: options.length === index + 1 ? observerRef : null })))); }))),
|
|
94
93
|
genCreateTagButton && genCreateTagButton(options))));
|
|
95
94
|
};
|
|
96
95
|
exports.OptionsSingle = OptionsSingle;
|
|
@@ -1,9 +1,10 @@
|
|
|
1
|
-
export function ModalHeaderStyle1({ title, linkTo, onClose, setAnimPos, initAnimPos, invert }: {
|
|
1
|
+
export function ModalHeaderStyle1({ title, linkTo, onClose, setAnimPos, initAnimPos, invert, dynamicHeaderHeight }: {
|
|
2
2
|
title: any;
|
|
3
3
|
linkTo: any;
|
|
4
4
|
onClose: any;
|
|
5
5
|
setAnimPos: any;
|
|
6
6
|
initAnimPos: any;
|
|
7
7
|
invert: any;
|
|
8
|
+
dynamicHeaderHeight?: boolean;
|
|
8
9
|
}): React.JSX.Element;
|
|
9
10
|
import React from "react";
|
|
@@ -10,8 +10,8 @@ var OKELink_1 = require("../../../../OKELink");
|
|
|
10
10
|
var Typo_1 = require("../../../../Typo");
|
|
11
11
|
var styled_1 = require("../../styled");
|
|
12
12
|
var ModalHeaderStyle1 = function (_a) {
|
|
13
|
-
var title = _a.title, linkTo = _a.linkTo, onClose = _a.onClose, setAnimPos = _a.setAnimPos, initAnimPos = _a.initAnimPos, invert = _a.invert;
|
|
14
|
-
return (react_1.default.createElement(styled_1.StyledModalLargeHeader, { invert: invert },
|
|
13
|
+
var title = _a.title, linkTo = _a.linkTo, onClose = _a.onClose, setAnimPos = _a.setAnimPos, initAnimPos = _a.initAnimPos, invert = _a.invert, _b = _a.dynamicHeaderHeight, dynamicHeaderHeight = _b === void 0 ? false : _b;
|
|
14
|
+
return (react_1.default.createElement(styled_1.StyledModalLargeHeader, { invert: invert, dynamicHeaderHeight: dynamicHeaderHeight },
|
|
15
15
|
react_1.default.createElement("div", { style: {
|
|
16
16
|
display: "flex",
|
|
17
17
|
gap: "2.5rem",
|
|
@@ -14,6 +14,7 @@ export interface genHeaderProps {
|
|
|
14
14
|
opacity: number;
|
|
15
15
|
};
|
|
16
16
|
invert: boolean;
|
|
17
|
+
dynamicHeaderHeight?: boolean;
|
|
17
18
|
}
|
|
18
19
|
export interface ModalProps {
|
|
19
20
|
title: string;
|
|
@@ -34,6 +35,7 @@ export interface ModalProps {
|
|
|
34
35
|
showConfirmBtn?: boolean;
|
|
35
36
|
alignActions?: alignActionsType;
|
|
36
37
|
disableHeader?: boolean;
|
|
38
|
+
dynamicHeaderHeight?: boolean;
|
|
37
39
|
}
|
|
38
40
|
/**
|
|
39
41
|
* @component Renders a modal component with customizable title, content, and actions.
|
|
@@ -57,6 +59,7 @@ export interface ModalProps {
|
|
|
57
59
|
* @prop {boolean} [showConfirmBtn]: A boolean indicating whether to render the confirm button. Defaults to false.
|
|
58
60
|
* @prop {('left' | 'right' | 'center')} [alignActions]: The alignment of the action buttons. Defaults to "right".
|
|
59
61
|
* @prop {boolean} [disableHeader]: A boolean indicating whether to render the header. Defaults to false.
|
|
62
|
+
* @prop {boolean} [dynamicHeaderHeight]: A boolean indicating whether the header (style1) should take a fixed height of 4rem or increase height flexibly as per the text within it. Defaults to false.
|
|
60
63
|
* @return {ReactElement} The rendered modal component.
|
|
61
64
|
*/
|
|
62
65
|
export declare const Modal: React.FunctionComponent<ModalProps>;
|
|
@@ -67,15 +67,16 @@ var Divider_1 = require("../../Divider");
|
|
|
67
67
|
* @prop {boolean} [showConfirmBtn]: A boolean indicating whether to render the confirm button. Defaults to false.
|
|
68
68
|
* @prop {('left' | 'right' | 'center')} [alignActions]: The alignment of the action buttons. Defaults to "right".
|
|
69
69
|
* @prop {boolean} [disableHeader]: A boolean indicating whether to render the header. Defaults to false.
|
|
70
|
+
* @prop {boolean} [dynamicHeaderHeight]: A boolean indicating whether the header (style1) should take a fixed height of 4rem or increase height flexibly as per the text within it. Defaults to false.
|
|
70
71
|
* @return {ReactElement} The rendered modal component.
|
|
71
72
|
*/
|
|
72
73
|
var Modal = function (_a) {
|
|
73
|
-
var title = _a.title, onClose = _a.onClose, children = _a.children, linkTo = _a.linkTo, _b = _a.desktopWidth, desktopWidth = _b === void 0 ? "80%" : _b, _c = _a.headerStyle, headerStyle = _c === void 0 ? "style1" : _c, subtitle = _a.subtitle, _d = _a.fitToContentHeight, fitToContentHeight = _d === void 0 ? false : _d, invert = _a.invert, overflowVisible = _a.overflowVisible, _e = _a.showActionPanel, showActionPanel = _e === void 0 ? false : _e, _f = _a.onCloseText, onCloseText = _f === void 0 ? "Close" : _f, onConfirm = _a.onConfirm, _g = _a.showCloseBtn, showCloseBtn = _g === void 0 ? true : _g, _h = _a.onConfirmText, onConfirmText = _h === void 0 ? "Confirm" : _h, _j = _a.showConfirmBtn, showConfirmBtn = _j === void 0 ? true : _j, _k = _a.alignActions, alignActions = _k === void 0 ? "right" : _k, _l = _a.disableHeader, disableHeader = _l === void 0 ? false : _l;
|
|
74
|
+
var title = _a.title, onClose = _a.onClose, children = _a.children, linkTo = _a.linkTo, _b = _a.desktopWidth, desktopWidth = _b === void 0 ? "80%" : _b, _c = _a.headerStyle, headerStyle = _c === void 0 ? "style1" : _c, subtitle = _a.subtitle, _d = _a.fitToContentHeight, fitToContentHeight = _d === void 0 ? false : _d, invert = _a.invert, overflowVisible = _a.overflowVisible, _e = _a.showActionPanel, showActionPanel = _e === void 0 ? false : _e, _f = _a.onCloseText, onCloseText = _f === void 0 ? "Close" : _f, onConfirm = _a.onConfirm, _g = _a.showCloseBtn, showCloseBtn = _g === void 0 ? true : _g, _h = _a.onConfirmText, onConfirmText = _h === void 0 ? "Confirm" : _h, _j = _a.showConfirmBtn, showConfirmBtn = _j === void 0 ? true : _j, _k = _a.alignActions, alignActions = _k === void 0 ? "right" : _k, _l = _a.disableHeader, disableHeader = _l === void 0 ? false : _l, _m = _a.dynamicHeaderHeight, dynamicHeaderHeight = _m === void 0 ? false : _m;
|
|
74
75
|
var screenWidth = (0, useScreenWidth_1.useScreenWidth)();
|
|
75
76
|
var handleClose = function () { return onClose(); };
|
|
76
77
|
var initAnimPos = { marginTop: "100dvh", opacity: 0 };
|
|
77
78
|
var endAnimPos = { marginTop: 0, opacity: 1 };
|
|
78
|
-
var
|
|
79
|
+
var _o = (0, react_1.useState)(endAnimPos), animPos = _o[0], setAnimPos = _o[1];
|
|
79
80
|
(0, react_1.useEffect)(function () {
|
|
80
81
|
document.body.style.overflow = "hidden";
|
|
81
82
|
return function () { document.body.style.overflow = "unset"; };
|
|
@@ -86,7 +87,7 @@ var Modal = function (_a) {
|
|
|
86
87
|
style2: ModalHeaderStyle2_1.ModalHeaderStyle2,
|
|
87
88
|
};
|
|
88
89
|
var Comp = headerStyles[headerStyle];
|
|
89
|
-
return (react_1.default.createElement(Comp, { title: title, subtitle: subtitle, setAnimPos: setAnimPos, linkTo: linkTo, onClose: onClose, initAnimPos: initAnimPos, invert: invert }));
|
|
90
|
+
return (react_1.default.createElement(Comp, { title: title, subtitle: subtitle, setAnimPos: setAnimPos, linkTo: linkTo, onClose: onClose, initAnimPos: initAnimPos, invert: invert, dynamicHeaderHeight: dynamicHeaderHeight }));
|
|
90
91
|
};
|
|
91
92
|
var takeFullScreenOnScroll = ["style1"].indexOf(headerStyle) !== -1
|
|
92
93
|
? true
|
|
@@ -18,6 +18,7 @@ export declare const StyledModalLargeBgColor: import("styled-components").Styled
|
|
|
18
18
|
export declare const StyledModalLargeContentWrapper: import("styled-components").StyledComponent<"div", any, StyledModalLargeContentWrapperProps, never>;
|
|
19
19
|
export declare const StyledModalLargeHeader: import("styled-components").StyledComponent<"header", any, {
|
|
20
20
|
invert?: boolean;
|
|
21
|
+
dynamicHeaderHeight?: boolean;
|
|
21
22
|
}, never>;
|
|
22
23
|
export declare const StyledModalBodyWrapper: import("styled-components").StyledComponent<"div", any, StyledModalBodyWrapperProps, never>;
|
|
23
24
|
export declare const StyledModalLargeBody: import("styled-components").StyledComponent<"div", any, StyledModalLargeBodyProps, never>;
|
|
@@ -43,9 +43,12 @@ exports.StyledModalLargeContentWrapper = styled_components_1.default.div(templat
|
|
|
43
43
|
var desktopWidth = _a.desktopWidth;
|
|
44
44
|
return desktopWidth;
|
|
45
45
|
});
|
|
46
|
-
exports.StyledModalLargeHeader = styled_components_1.default.header(templateObject_6 || (templateObject_6 = __makeTemplateObject(["\n background-color: ", ";\n /* width: 100%; */\n height:
|
|
46
|
+
exports.StyledModalLargeHeader = styled_components_1.default.header(templateObject_6 || (templateObject_6 = __makeTemplateObject(["\n background-color: ", ";\n /* width: 100%; */\n height: ", ";\n display: flex;\n justify-content: space-between;\n align-items: center;\n padding: 0.5rem 2rem;\n position: sticky;\n top: 0;\n z-index: 100;\n"], ["\n background-color: ", ";\n /* width: 100%; */\n height: ", ";\n display: flex;\n justify-content: space-between;\n align-items: center;\n padding: 0.5rem 2rem;\n position: sticky;\n top: 0;\n z-index: 100;\n"])), function (_a) {
|
|
47
47
|
var invert = _a.invert;
|
|
48
48
|
return (invert ? themes_1.colors.greyColor90 : greyColor5);
|
|
49
|
+
}, function (_a) {
|
|
50
|
+
var dynamicHeaderHeight = _a.dynamicHeaderHeight;
|
|
51
|
+
return (dynamicHeaderHeight ? 'unset' : '4rem');
|
|
49
52
|
});
|
|
50
53
|
exports.StyledModalBodyWrapper = styled_components_1.default.div(templateObject_7 || (templateObject_7 = __makeTemplateObject(["\n display: flex;\n flex-direction: column;\n justify-content: space-between;\n overflow: ", ";\n"], ["\n display: flex;\n flex-direction: column;\n justify-content: space-between;\n overflow: ", ";\n"])), function (_a) {
|
|
51
54
|
var takeFullScreenOnScroll = _a.takeFullScreenOnScroll, overflowVisible = _a.overflowVisible;
|
|
@@ -80,8 +80,8 @@ exports.default = {
|
|
|
80
80
|
};
|
|
81
81
|
var TabBar_ = function (args) {
|
|
82
82
|
var options = [
|
|
83
|
-
{ display: "display 1", value: "value1" },
|
|
84
|
-
{ display: "display 2", value: "value2" },
|
|
83
|
+
{ display: "display 1", value: "value1", icon: 'Funnel' },
|
|
84
|
+
{ display: "display 2", value: "value2", icon: 'ListDashes' },
|
|
85
85
|
{ display: "Lorem ipsum dolor sit amet, consectetur adipiscing elit.", value: "value3" },
|
|
86
86
|
{ display: "display 3", value: "value4" },
|
|
87
87
|
{ display: "display 4", value: "value5" },
|
|
@@ -25,6 +25,7 @@ var mixins_1 = require("../../../themes/mixins");
|
|
|
25
25
|
var Typo2_1 = require("../Typo2");
|
|
26
26
|
var phosphor_react_1 = require("phosphor-react");
|
|
27
27
|
var colors_1 = require("../../themes/colors");
|
|
28
|
+
var icons_1 = require("../../../icons");
|
|
28
29
|
var Base = function (_a) {
|
|
29
30
|
var id = _a.id, options = _a.options, valueProp = _a.value, onChange = _a.onChange, style = _a.style, errorTabs = _a.errorTabs, disabledTabs = _a.disabledTabs, _b = _a.tabBarStyle, tabBarStyle = _b === void 0 ? '1' : _b, saveValueAsString = _a.saveValueAsString, _c = _a.black, black = _c === void 0 ? false : _c, M = _a.M, S = _a.S, _size = _a.size //use any one of these 3
|
|
30
31
|
;
|
|
@@ -34,6 +35,13 @@ var Base = function (_a) {
|
|
|
34
35
|
var handleClick = function (v) {
|
|
35
36
|
onChange && onChange(id, saveValueAsString ? v.value : v);
|
|
36
37
|
};
|
|
38
|
+
var genIconInTab = function (iconName) {
|
|
39
|
+
var IconComp = icons_1.icons[iconName];
|
|
40
|
+
if (!IconComp)
|
|
41
|
+
return null;
|
|
42
|
+
//else
|
|
43
|
+
return react_1.default.createElement(IconComp, { weight: 'bold', size: 16 });
|
|
44
|
+
};
|
|
37
45
|
return (react_1.default.createElement(index_styled_1.TabBarStyled, { size: size, style: style },
|
|
38
46
|
react_1.default.createElement(index_styled_1.TabBarContainerStyled, { id: id },
|
|
39
47
|
!scrollIsAtStart && (react_1.default.createElement(index_styled_1.StyledDirectionButtons, { left: true },
|
|
@@ -45,7 +53,9 @@ var Base = function (_a) {
|
|
|
45
53
|
var tabIsActive = value && op.value === value.value;
|
|
46
54
|
return (react_1.default.createElement(index_styled_1.TabBarTabWrapper, { tabBarStyle: tabBarStyle, key: op.value, active: tabIsActive, error: tabHasError, disabled: tabIsDisabled, black: black },
|
|
47
55
|
react_1.default.createElement(index_styled_1.TabBarTabStyled, { size: size, active: tabIsActive, error: tabHasError, disabled: tabIsDisabled, tabBarStyle: tabBarStyle, onClick: function () { return handleClick(op); }, black: black },
|
|
48
|
-
react_1.default.createElement(
|
|
56
|
+
react_1.default.createElement("div", { style: { display: 'flex', alignItems: 'center', gap: '0.4rem' } },
|
|
57
|
+
op.icon && genIconInTab(op.icon),
|
|
58
|
+
op.display && react_1.default.createElement(index_styled_1.STYLED_TYPO, { capitalize: true }, op.display)),
|
|
49
59
|
tabHasError && react_1.default.createElement(index_styled_1.StyledDot, { active: tabIsActive, error: tabHasError, tabBarStyle: tabBarStyle }))));
|
|
50
60
|
}))),
|
|
51
61
|
!scrollIsAtEnd && (react_1.default.createElement(index_styled_1.StyledDirectionButtons, { right: true },
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "oolib",
|
|
3
|
-
"version": "2.168.
|
|
3
|
+
"version": "2.168.3",
|
|
4
4
|
"description": " OKE Component Library",
|
|
5
5
|
"main": "dist/index.js",
|
|
6
6
|
"types": "dist/index.d.ts",
|
|
@@ -71,11 +71,11 @@
|
|
|
71
71
|
"typescript": "^5.4.3"
|
|
72
72
|
},
|
|
73
73
|
"peerDependencies": {
|
|
74
|
+
"date-fns": "^2.0.0",
|
|
74
75
|
"react": "^17.0.2",
|
|
75
76
|
"react-dom": "^17.0.2",
|
|
76
77
|
"react-router-dom": "^6.28.0",
|
|
77
|
-
"styled-components": "^5.3.3"
|
|
78
|
-
"date-fns": "^2.0.0"
|
|
78
|
+
"styled-components": "^5.3.3"
|
|
79
79
|
},
|
|
80
80
|
"config": {
|
|
81
81
|
"commitizen": {
|
|
@@ -107,7 +107,6 @@
|
|
|
107
107
|
"phosphor-react": "^1.4.1",
|
|
108
108
|
"react-datepicker": "^7.6.0",
|
|
109
109
|
"react-player": "^2.12.0",
|
|
110
|
-
"react-virtualized": "^9.22.5",
|
|
111
110
|
"recharts": "^2.12.7"
|
|
112
111
|
}
|
|
113
112
|
}
|
|
@@ -1,66 +0,0 @@
|
|
|
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 (mod) {
|
|
19
|
-
if (mod && mod.__esModule) return mod;
|
|
20
|
-
var result = {};
|
|
21
|
-
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
|
|
22
|
-
__setModuleDefault(result, mod);
|
|
23
|
-
return result;
|
|
24
|
-
};
|
|
25
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
26
|
-
exports.VirtualizedWrapper = void 0;
|
|
27
|
-
var react_1 = __importStar(require("react"));
|
|
28
|
-
var styled_1 = require("./styled");
|
|
29
|
-
var react_virtualized_1 = require("react-virtualized");
|
|
30
|
-
var VirtualizedWrapper = function (_a) {
|
|
31
|
-
var children = _a.children, options = _a.options, lightboxHeight = _a.lightboxHeight, searchString = _a.searchString;
|
|
32
|
-
// Create a cache for measuring row heights
|
|
33
|
-
var cache = (0, react_1.useRef)(new react_virtualized_1.CellMeasurerCache({
|
|
34
|
-
fixedWidth: true,
|
|
35
|
-
defaultHeight: 50, // default height for each row before height is calculated
|
|
36
|
-
}));
|
|
37
|
-
(0, react_1.useEffect)(function () {
|
|
38
|
-
}, [options.length, searchString]);
|
|
39
|
-
return (react_1.default.createElement(react_1.default.Fragment, null, options.length > 30 ?
|
|
40
|
-
react_1.default.createElement(styled_1.StyledOptionsShellWrapper, { lightboxHeight: lightboxHeight },
|
|
41
|
-
react_1.default.createElement(react_virtualized_1.AutoSizer, null, function (_a) {
|
|
42
|
-
var width = _a.width, height = _a.height;
|
|
43
|
-
return (react_1.default.createElement(react_virtualized_1.List, { width: width, height: height, rowHeight: cache.current.rowHeight, deferredMeasurementCache: cache.current, rowCount: options.length, rowRenderer: function (_a) {
|
|
44
|
-
var key = _a.key, index = _a.index, style = _a.style, parent = _a.parent;
|
|
45
|
-
var option = options[index];
|
|
46
|
-
return (react_1.default.createElement(react_virtualized_1.CellMeasurer, { key: key, cache: cache.current, parent: parent, columnIndex: 0, rowIndex: index }, children(option, index, style)));
|
|
47
|
-
} }));
|
|
48
|
-
}))
|
|
49
|
-
:
|
|
50
|
-
options.map(function (option, index) { return (children(option, index)); })));
|
|
51
|
-
};
|
|
52
|
-
exports.VirtualizedWrapper = VirtualizedWrapper;
|
|
53
|
-
// ################ AutoSizer #######
|
|
54
|
-
// The AutoSizer component is used to automatically calculate and adjust
|
|
55
|
-
// the size of its child components based on the available space.
|
|
56
|
-
// It wraps around the List component to dynamically resize the list based on the dimensions of its parent container.
|
|
57
|
-
// ################ List ##########
|
|
58
|
-
// The List component is a virtualized list that efficiently renders a
|
|
59
|
-
// large number of items by only rendering the visible items on the screen.
|
|
60
|
-
// It accepts a rowCount prop to specify the total number of items in the list,
|
|
61
|
-
// and a rowRenderer prop to define how each item should be rendered.
|
|
62
|
-
// ################ Cell Measurer #############
|
|
63
|
-
// The CellMeasurer component is used within the rowRenderer function
|
|
64
|
-
// to measure the dimensions of each item in the list.
|
|
65
|
-
// It calculates the height and width of each cell and provides this information to the List component,
|
|
66
|
-
// allowing it to efficiently render the list with variable-sized items.
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export const StyledOptionsShellWrapper: import("styled-components").StyledComponent<"div", any, {}, never>;
|
|
@@ -1,45 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var __makeTemplateObject = (this && this.__makeTemplateObject) || function (cooked, raw) {
|
|
3
|
-
if (Object.defineProperty) { Object.defineProperty(cooked, "raw", { value: raw }); } else { cooked.raw = raw; }
|
|
4
|
-
return cooked;
|
|
5
|
-
};
|
|
6
|
-
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
7
|
-
if (k2 === undefined) k2 = k;
|
|
8
|
-
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
9
|
-
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
10
|
-
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
11
|
-
}
|
|
12
|
-
Object.defineProperty(o, k2, desc);
|
|
13
|
-
}) : (function(o, m, k, k2) {
|
|
14
|
-
if (k2 === undefined) k2 = k;
|
|
15
|
-
o[k2] = m[k];
|
|
16
|
-
}));
|
|
17
|
-
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
18
|
-
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
19
|
-
}) : function(o, v) {
|
|
20
|
-
o["default"] = v;
|
|
21
|
-
});
|
|
22
|
-
var __importStar = (this && this.__importStar) || function (mod) {
|
|
23
|
-
if (mod && mod.__esModule) return mod;
|
|
24
|
-
var result = {};
|
|
25
|
-
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
|
|
26
|
-
__setModuleDefault(result, mod);
|
|
27
|
-
return result;
|
|
28
|
-
};
|
|
29
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
30
|
-
exports.StyledOptionsShellWrapper = void 0;
|
|
31
|
-
var styled_components_1 = __importStar(require("styled-components"));
|
|
32
|
-
var mixins_1 = require("../../../../themes/mixins");
|
|
33
|
-
exports.StyledOptionsShellWrapper = styled_components_1.default.div(templateObject_1 || (templateObject_1 = __makeTemplateObject(["\n \n width: 100%;\n \n ", " {\n width: 36rem;\n }\n height: ", ";\n\n"], ["\n \n width: 100%;\n \n ", " {\n width: 36rem;\n }\n height: ", ";\n\n"])), (0, mixins_1.mediaQuery)("md"), function (_a) {
|
|
34
|
-
var lightboxHeight = _a.lightboxHeight;
|
|
35
|
-
switch (lightboxHeight) {
|
|
36
|
-
case 'large':
|
|
37
|
-
return '33rem';
|
|
38
|
-
case 'small':
|
|
39
|
-
return '20rem';
|
|
40
|
-
case 'medium':
|
|
41
|
-
default:
|
|
42
|
-
return '24rem';
|
|
43
|
-
}
|
|
44
|
-
});
|
|
45
|
-
var templateObject_1;
|