oolib 2.70.0 → 2.70.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1,12 @@
1
+ export function OptionsAnimateWrapper({ options, optionsRef, relativeToRef, showOptions, invert, yOrientation, fixPos, optionsAnchor, children, }: {
2
+ options: any;
3
+ optionsRef: any;
4
+ relativeToRef: any;
5
+ showOptions: any;
6
+ invert: any;
7
+ yOrientation: any;
8
+ fixPos: any;
9
+ optionsAnchor: any;
10
+ children: any;
11
+ }): React.JSX.Element;
12
+ import React from "react";
@@ -0,0 +1,67 @@
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 __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
14
+ if (k2 === undefined) k2 = k;
15
+ var desc = Object.getOwnPropertyDescriptor(m, k);
16
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
17
+ desc = { enumerable: true, get: function() { return m[k]; } };
18
+ }
19
+ Object.defineProperty(o, k2, desc);
20
+ }) : (function(o, m, k, k2) {
21
+ if (k2 === undefined) k2 = k;
22
+ o[k2] = m[k];
23
+ }));
24
+ var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
25
+ Object.defineProperty(o, "default", { enumerable: true, value: v });
26
+ }) : function(o, v) {
27
+ o["default"] = v;
28
+ });
29
+ var __importStar = (this && this.__importStar) || function (mod) {
30
+ if (mod && mod.__esModule) return mod;
31
+ var result = {};
32
+ if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
33
+ __setModuleDefault(result, mod);
34
+ return result;
35
+ };
36
+ Object.defineProperty(exports, "__esModule", { value: true });
37
+ exports.OptionsAnimateWrapper = void 0;
38
+ var react_1 = __importStar(require("react"));
39
+ var styled_1 = require("./styled");
40
+ var OptionsAnimateWrapper = function (_a) {
41
+ var _b;
42
+ var _c;
43
+ var options = _a.options, optionsRef = _a.optionsRef, relativeToRef = _a.relativeToRef, showOptions = _a.showOptions, invert = _a.invert, yOrientation = _a.yOrientation, fixPos = _a.fixPos, optionsAnchor = _a.optionsAnchor, children = _a.children;
44
+ var selectCompRect = (_c = relativeToRef === null || relativeToRef === void 0 ? void 0 : relativeToRef.current) === null || _c === void 0 ? void 0 : _c.getBoundingClientRect();
45
+ //we need to recalc when ops length change because, in tag comps, when loading a fixed set of 'loading' options are shown
46
+ //before the actual number of options are loaded
47
+ //useMemo wont work cuz it runs before render, and before render ref doesnt exist.
48
+ var _d = (0, react_1.useState)({
49
+ width: undefined,
50
+ openHeight: undefined,
51
+ }), _e = _d[0], width = _e.width, openHeight = _e.openHeight, setWidthAndOpenHeight = _d[1];
52
+ (0, react_1.useEffect)(function () {
53
+ var _a, _b, _c, _d;
54
+ setWidthAndOpenHeight({
55
+ width: (_b = (_a = optionsRef.current) === null || _a === void 0 ? void 0 : _a.getBoundingClientRect()) === null || _b === void 0 ? void 0 : _b.width,
56
+ openHeight: (_d = (_c = optionsRef.current) === null || _c === void 0 ? void 0 : _c.getBoundingClientRect()) === null || _d === void 0 ? void 0 : _d.height,
57
+ });
58
+ }, [options.length]);
59
+ return (react_1.default.createElement(styled_1.StyledOptionsAnimateWrapper, { invert: invert, isOpen: showOptions, width: width, openHeight: openHeight, style: __assign({ zIndex: 100000 }, (fixPos
60
+ ? __assign({ position: "fixed", top: "".concat(fixPos.y -
61
+ (yOrientation === "top" ? (selectCompRect === null || selectCompRect === void 0 ? void 0 : selectCompRect.height) || 0 : 0), "px"), left: "".concat(fixPos.x, "px") }, (yOrientation === "top"
62
+ ? { transform: "translateY(-100%)" }
63
+ : {})) : __assign(__assign({ position: "absolute" }, (optionsAnchor ? (_b = {}, _b[optionsAnchor] = 0, _b) : { left: 0 })), (yOrientation === "bottom"
64
+ ? { bottom: 0, transform: "translateY(100%)" }
65
+ : { top: 0, transform: "translateY(-100%)" })))) }, children));
66
+ };
67
+ exports.OptionsAnimateWrapper = OptionsAnimateWrapper;
@@ -0,0 +1,2 @@
1
+ /** for lightbox shell */
2
+ export const StyledOptionsAnimateWrapper: import("styled-components").StyledComponent<"div", any, {}, never>;
@@ -0,0 +1,25 @@
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 __importDefault = (this && this.__importDefault) || function (mod) {
7
+ return (mod && mod.__esModule) ? mod : { "default": mod };
8
+ };
9
+ Object.defineProperty(exports, "__esModule", { value: true });
10
+ exports.StyledOptionsAnimateWrapper = void 0;
11
+ var styled_components_1 = __importDefault(require("styled-components"));
12
+ var globalVariables_1 = require("../../../../../../globalStyles/globalVariables");
13
+ var mixins_1 = require("../../../../../../themes/mixins");
14
+ /** for lightbox shell */
15
+ exports.StyledOptionsAnimateWrapper = styled_components_1.default.div(templateObject_1 || (templateObject_1 = __makeTemplateObject(["\n height: ", ";\n /**\n 'else 100%' is very important. \n what this does is, on first render, it allows the optionsWrapper within to take whatever width \n its supposed to i.e max-content / 100% width of select / 36rem.\n Then on the next render (after the ref has already been attached to optionsWrapper), the proper width\n gets calculated and passed to this component.\n\n Without this 100%, this will not work > scenarios where there is enough space for the dropdown to \n stretch to the width of the select OR 36rem. Instead it will always stick to its min-width which is \n max-content\n */\n width: ", ";\n overflow: hidden;\n ", ";\n ", ";\n border-width: ", "; //hack, otherwsie this shit line shows when options are closed\n"], ["\n height: ", ";\n /**\n 'else 100%' is very important. \n what this does is, on first render, it allows the optionsWrapper within to take whatever width \n its supposed to i.e max-content / 100% width of select / 36rem.\n Then on the next render (after the ref has already been attached to optionsWrapper), the proper width\n gets calculated and passed to this component.\n\n Without this 100%, this will not work > scenarios where there is enough space for the dropdown to \n stretch to the width of the select OR 36rem. Instead it will always stick to its min-width which is \n max-content\n */\n width: ", ";\n overflow: hidden;\n ", ";\n ", ";\n border-width: ", "; //hack, otherwsie this shit line shows when options are closed\n"])), function (_a) {
16
+ var isOpen = _a.isOpen, openHeight = _a.openHeight;
17
+ return isOpen ? (openHeight ? openHeight + 'px' : 'auto') : 0;
18
+ }, function (_a) {
19
+ var width = _a.width;
20
+ return width ? width + 'px' : '100%';
21
+ }, (0, mixins_1.transition)('height', 'border-width'), globalVariables_1.globalLightboxStyle, function (_a) {
22
+ var isOpen = _a.isOpen;
23
+ return isOpen ? '1px' : 0;
24
+ });
25
+ var templateObject_1;
@@ -44,13 +44,12 @@ var usePopOutOfOverflowHiddenParent_1 = require("../../../../utils/usePopOutOfOv
44
44
  var Buttons_1 = require("../../../Buttons");
45
45
  var ModalLarge_1 = require("../../../Modals/ModalLarge");
46
46
  var styled_1 = require("./styled");
47
+ var OptionsAnimateWrapper_1 = require("./comps/OptionsAnimateWrapper");
47
48
  exports.OptionsShell = react_1.default.forwardRef(function (_a, ref) {
48
- var _b;
49
- var _c, _d, _e, _f, _g;
50
- var yOrientation = _a.yOrientation, lightboxHeight = _a.lightboxHeight, lightboxStyle = _a.lightboxStyle, options = _a.options, optionsAnchor = _a.optionsAnchor, showOptions = _a.showOptions, handleHideOptions = _a.handleHideOptions, children = _a.children, SelectComp = _a.SelectComp, label = _a.label, optionsModalLabel = _a.optionsModalLabel, invert = _a.invert, showDoneButton = _a.showDoneButton, _h = _a.popOutOfOverflowHiddenParent, popOutOfOverflowHiddenParent = _h === void 0 ? false : _h, relativeToRef = _a.relativeToRef, S = _a.S;
49
+ var yOrientation = _a.yOrientation, lightboxHeight = _a.lightboxHeight, lightboxStyle = _a.lightboxStyle, options = _a.options, optionsAnchor = _a.optionsAnchor, showOptions = _a.showOptions, handleHideOptions = _a.handleHideOptions, children = _a.children, SelectComp = _a.SelectComp, label = _a.label, optionsModalLabel = _a.optionsModalLabel, invert = _a.invert, showDoneButton = _a.showDoneButton, _b = _a.popOutOfOverflowHiddenParent, popOutOfOverflowHiddenParent = _b === void 0 ? false : _b, relativeToRef = _a.relativeToRef, S = _a.S;
51
50
  var screenWidth = (0, useScreenWidth_1.useScreenWidth)();
52
51
  var isDesktop = screenWidth >= (0, mixins_1.getBreakPoint)("sm");
53
- var _j = (0, usePopOutOfOverflowHiddenParent_1.usePopOutOfOverflowHiddenParent)(popOutOfOverflowHiddenParent), fixPos = _j.fixPos, applyFixedPos = _j.applyFixedPos, removeFixedPos = _j.removeFixedPos, trackerRef = _j.trackerRef;
52
+ var _c = (0, usePopOutOfOverflowHiddenParent_1.usePopOutOfOverflowHiddenParent)(popOutOfOverflowHiddenParent), fixPos = _c.fixPos, applyFixedPos = _c.applyFixedPos, removeFixedPos = _c.removeFixedPos, trackerRef = _c.trackerRef;
54
53
  (0, react_1.useEffect)(function () {
55
54
  if (popOutOfOverflowHiddenParent) {
56
55
  if (showOptions)
@@ -59,16 +58,19 @@ exports.OptionsShell = react_1.default.forwardRef(function (_a, ref) {
59
58
  removeFixedPos();
60
59
  }
61
60
  }, [showOptions]);
62
- var selectCompRect = (_c = relativeToRef === null || relativeToRef === void 0 ? void 0 : relativeToRef.current) === null || _c === void 0 ? void 0 : _c.getBoundingClientRect();
63
61
  return isDesktop ? (react_1.default.createElement(react_1.Fragment, null,
64
62
  popOutOfOverflowHiddenParent && react_1.default.createElement("div", { ref: trackerRef }),
65
- react_1.default.createElement(styled_1.StyledOptionsAnimateWrapper, { invert: invert, isOpen: showOptions, width: (_e = (_d = ref.current) === null || _d === void 0 ? void 0 : _d.getBoundingClientRect()) === null || _e === void 0 ? void 0 : _e.width, openHeight: (_g = (_f = ref.current) === null || _f === void 0 ? void 0 : _f.getBoundingClientRect()) === null || _g === void 0 ? void 0 : _g.height, style: __assign({ zIndex: 100000 }, (fixPos
66
- ? __assign({ position: "fixed", top: "".concat(fixPos.y -
67
- (yOrientation === "top" ? (selectCompRect === null || selectCompRect === void 0 ? void 0 : selectCompRect.height) || 0 : 0), "px"), left: "".concat(fixPos.x, "px") }, (yOrientation === "top"
68
- ? { transform: "translateY(-100%)" }
69
- : {})) : __assign(__assign({ position: "absolute" }, (optionsAnchor ? (_b = {}, _b[optionsAnchor] = 0, _b) : { left: 0 })), (yOrientation === "bottom"
70
- ? { bottom: 0, transform: "translateY(100%)" }
71
- : { top: 0, transform: "translateY(-100%)" })))) },
63
+ react_1.default.createElement(OptionsAnimateWrapper_1.OptionsAnimateWrapper, __assign({}, {
64
+ options: options,
65
+ optionsRef: ref,
66
+ relativeToRef: relativeToRef,
67
+ showOptions: showOptions,
68
+ invert: invert,
69
+ yOrientation: yOrientation,
70
+ fixPos: fixPos,
71
+ optionsAnchor: optionsAnchor,
72
+ children: children,
73
+ }),
72
74
  react_1.default.createElement(styled_1.StyledOptionsWrapper, { id: "StyledOptionsWrapper", ref: ref, invert: invert, lightboxHeight: lightboxHeight,
73
75
  // className={className}
74
76
  style: __assign(__assign({}, (lightboxStyle || {})), { position: "absolute", bottom: yOrientation === "top" ? undefined : 0, top: yOrientation === "top" ? 0 : undefined }) }, children)))) : (react_1.default.createElement(framer_motion_1.AnimatePresence, null, showOptions ? (react_1.default.createElement(ModalLarge_1.ModalLarge, { fitToContentHeight: true, title: optionsModalLabel || label, onClose: handleHideOptions, invert: invert, S: S },
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "oolib",
3
- "version": "2.70.0",
3
+ "version": "2.70.1",
4
4
  "description": " OKE Component Library",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",