oolib 2.168.2 → 2.168.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.
@@ -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(VirtualizedWrapper_1.VirtualizedWrapper, { options: options, lightboxHeight: lightboxHeight, searchString: searchString }, function (option, index, style) { 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) {
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, style: style && style }, 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 })))); })),
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>;
@@ -45,6 +45,40 @@ var ModalHeaderStyle2_1 = require("./comps/ModalHeaderStyle2");
45
45
  var styled_1 = require("./styled");
46
46
  var Buttons_1 = require("../../Buttons");
47
47
  var Divider_1 = require("../../Divider");
48
+ var useFreezePageBehind = function () {
49
+ (0, react_1.useEffect)(function () {
50
+ // Store original values
51
+ var originalStyle = window.getComputedStyle(document.body);
52
+ var originalOverflow = originalStyle.overflow;
53
+ var originalPosition = originalStyle.position;
54
+ var originalWidth = originalStyle.width;
55
+ var originalHeight = originalStyle.height;
56
+ var originalTop = document.body.style.top;
57
+ // Get current scroll position
58
+ var scrollY = window.scrollY;
59
+ // Apply multiple techniques to prevent scrolling
60
+ document.body.style.overflow = 'hidden';
61
+ document.body.style.position = 'fixed';
62
+ document.body.style.width = '100%';
63
+ document.body.style.height = '100%';
64
+ document.body.style.top = "-".concat(scrollY, "px");
65
+ // Touch events backup for iOS
66
+ var preventDefault = function (e) { return e.preventDefault(); };
67
+ document.addEventListener('touchmove', preventDefault, { passive: false });
68
+ return function () {
69
+ // Restore original styles
70
+ document.body.style.overflow = originalOverflow;
71
+ document.body.style.position = originalPosition;
72
+ document.body.style.width = originalWidth;
73
+ document.body.style.height = originalHeight;
74
+ document.body.style.top = originalTop;
75
+ // Restore scroll position
76
+ window.scrollTo(0, scrollY);
77
+ // Remove touch event listener
78
+ document.removeEventListener('touchmove', preventDefault);
79
+ };
80
+ }, []);
81
+ };
48
82
  /**
49
83
  * @component Renders a modal component with customizable title, content, and actions.
50
84
  *
@@ -67,26 +101,28 @@ var Divider_1 = require("../../Divider");
67
101
  * @prop {boolean} [showConfirmBtn]: A boolean indicating whether to render the confirm button. Defaults to false.
68
102
  * @prop {('left' | 'right' | 'center')} [alignActions]: The alignment of the action buttons. Defaults to "right".
69
103
  * @prop {boolean} [disableHeader]: A boolean indicating whether to render the header. Defaults to false.
104
+ * @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
105
  * @return {ReactElement} The rendered modal component.
71
106
  */
72
107
  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;
108
+ 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
109
  var screenWidth = (0, useScreenWidth_1.useScreenWidth)();
75
110
  var handleClose = function () { return onClose(); };
76
111
  var initAnimPos = { marginTop: "100dvh", opacity: 0 };
77
112
  var endAnimPos = { marginTop: 0, opacity: 1 };
78
- var _m = (0, react_1.useState)(endAnimPos), animPos = _m[0], setAnimPos = _m[1];
79
- (0, react_1.useEffect)(function () {
80
- document.body.style.overflow = "hidden";
81
- return function () { document.body.style.overflow = "unset"; };
82
- }, []);
113
+ var _o = (0, react_1.useState)(endAnimPos), animPos = _o[0], setAnimPos = _o[1];
114
+ // useEffect(() => {
115
+ // document.body.style.overflow = "hidden";
116
+ // return () => { document.body.style.overflow = "unset" };
117
+ // }, []);
118
+ useFreezePageBehind();
83
119
  var genHeader = function () {
84
120
  var headerStyles = {
85
121
  style1: ModalHeaderStyle1_1.ModalHeaderStyle1,
86
122
  style2: ModalHeaderStyle2_1.ModalHeaderStyle2,
87
123
  };
88
124
  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 }));
125
+ return (react_1.default.createElement(Comp, { title: title, subtitle: subtitle, setAnimPos: setAnimPos, linkTo: linkTo, onClose: onClose, initAnimPos: initAnimPos, invert: invert, dynamicHeaderHeight: dynamicHeaderHeight }));
90
126
  };
91
127
  var takeFullScreenOnScroll = ["style1"].indexOf(headerStyle) !== -1
92
128
  ? 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>;
@@ -33,7 +33,7 @@ var themes_1 = require("../../../themes");
33
33
  var framer_motion_1 = require("framer-motion");
34
34
  var styled_components_1 = __importStar(require("styled-components"));
35
35
  var black_opacity80 = themes_1.colors.black_opacity80, white = themes_1.colors.white, greyColor5 = themes_1.colors.greyColor5, greyColor15 = themes_1.colors.greyColor15;
36
- exports.StyledModalLargeBg = (0, styled_components_1.default)(framer_motion_1.motion.div)(templateObject_1 || (templateObject_1 = __makeTemplateObject(["\n width: 100vw;\n height: 100%;\n position: fixed;\n left: 0;\n bottom: 0;\n z-index: 999999999;\n overflow-y: auto;\n overflow-x: hidden;\n ", " {\n display: flex;\n justify-content: center;\n align-items: center;\n }\n"], ["\n width: 100vw;\n height: 100%;\n position: fixed;\n left: 0;\n bottom: 0;\n z-index: 999999999;\n overflow-y: auto;\n overflow-x: hidden;\n ", " {\n display: flex;\n justify-content: center;\n align-items: center;\n }\n"])), (0, mixins_1.mediaQuery)("sm"));
36
+ exports.StyledModalLargeBg = (0, styled_components_1.default)(framer_motion_1.motion.div)(templateObject_1 || (templateObject_1 = __makeTemplateObject(["\n width: 100vw;\n height: 100dvh;\n position: fixed;\n left: 0;\n bottom: 0;\n z-index: 999999999;\n overflow-y: auto;\n overflow-x: hidden;\n ", " {\n display: flex;\n justify-content: center;\n align-items: center;\n }\n"], ["\n width: 100vw;\n height: 100dvh;\n position: fixed;\n left: 0;\n bottom: 0;\n z-index: 999999999;\n overflow-y: auto;\n overflow-x: hidden;\n ", " {\n display: flex;\n justify-content: center;\n align-items: center;\n }\n"])), (0, mixins_1.mediaQuery)("sm"));
37
37
  exports.StyledModalLargeBgColor = (0, styled_components_1.default)(framer_motion_1.motion.div)(templateObject_2 || (templateObject_2 = __makeTemplateObject(["\n background: ", ";\n position: absolute;\n left: 0;\n top: 0;\n width: 100vw;\n height: 100dvh;\n"], ["\n background: ", ";\n position: absolute;\n left: 0;\n top: 0;\n width: 100vw;\n height: 100dvh;\n"])), black_opacity80);
38
38
  exports.StyledModalLargeContentWrapper = styled_components_1.default.div(templateObject_5 || (templateObject_5 = __makeTemplateObject(["\n width: 100%;\n margin-top: 4rem;\n background-color: ", ";\n ", "\n ", " {\n margin-top: 0;\n border: 2px solid ", ";\n width: ", ";\n /* min-height: 50dvh; */\n max-height: 90dvh;\n position: relative;\n display: flex;\n flex-direction: column;\n border-radius: 0.2rem;\n margin: 0 auto;\n }\n"], ["\n width: 100%;\n margin-top: 4rem;\n background-color: ", ";\n ", "\n ", " {\n margin-top: 0;\n border: 2px solid ", ";\n width: ", ";\n /* min-height: 50dvh; */\n max-height: 90dvh;\n position: relative;\n display: flex;\n flex-direction: column;\n border-radius: 0.2rem;\n margin: 0 auto;\n }\n"])), white, function (_a) {
39
39
  var takeFullScreenOnScroll = _a.takeFullScreenOnScroll;
@@ -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: 4rem;\n display: flex;\n justify-content: space-between;\n align-items: center;\n padding: 0 2rem;\n position: sticky;\n top: 0;\n z-index: 100;\n"], ["\n background-color: ", ";\n /* width: 100%; */\n height: 4rem;\n display: flex;\n justify-content: space-between;\n align-items: center;\n padding: 0 2rem;\n position: sticky;\n top: 0;\n z-index: 100;\n"])), function (_a) {
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;
@@ -250,7 +250,8 @@ var Dropdowns = function (args) {
250
250
  var _a;
251
251
  return (__assign(__assign({}, prev), (_a = {}, _a[args.selection] = v, _a)));
252
252
  });
253
- }, selectConfig: args.showIconInSelectArea ? ["display", "icon"] : args.showColorInSelectArea ? ["display", "color"] : ["display"], label: "Dropdown Component", sublabel: "Select single or multiple options in dropdown based on Selection Type", popOutOfOverflowHiddenParent: args.popOutOfOverflowHiddenParent }))))));
253
+ }, selectConfig: args.showIconInSelectArea ? ["display", "icon"] : args.showColorInSelectArea ? ["display", "color"] : ["display"], label: "Dropdown Component", sublabel: "Select single or multiple options in dropdown based on Selection Type", popOutOfOverflowHiddenParent: args.popOutOfOverflowHiddenParent }))),
254
+ react_1.default.createElement("div", { style: { height: '1000px', background: 'red' } }))));
254
255
  };
255
256
  exports.Dropdowns = Dropdowns;
256
257
  // export const Button_Primary = (args) => (
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "oolib",
3
- "version": "2.168.2",
3
+ "version": "2.168.4",
4
4
  "description": " OKE Component Library",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",
@@ -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,7 +0,0 @@
1
- export function VirtualizedWrapper({ children, options, lightboxHeight, searchString }: {
2
- children: any;
3
- options: any;
4
- lightboxHeight: any;
5
- searchString: any;
6
- }): React.JSX.Element;
7
- import React from 'react';
@@ -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;