oolib 2.89.2 → 2.90.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.
@@ -1,4 +1,4 @@
1
- export function ActionMenu({ icon, invert, actions, align, iconSize, M, ButtonComp: _ButtonComp, setShowActions: setShowActionsInParent, popOutOfOverflowHiddenParent, CustomSelectComp, storybookPreview }: {
1
+ export function ActionMenu({ icon, invert, actions, align, iconSize, M, ButtonComp: _ButtonComp, setShowActions: setShowActionsInParent, popOutOfOverflowHiddenParent, CustomSelectComp, storybookPreview, useLightboxPortal, }: {
2
2
  icon?: string;
3
3
  invert: any;
4
4
  actions: any;
@@ -10,5 +10,6 @@ export function ActionMenu({ icon, invert, actions, align, iconSize, M, ButtonCo
10
10
  popOutOfOverflowHiddenParent?: boolean;
11
11
  CustomSelectComp: any;
12
12
  storybookPreview: any;
13
+ useLightboxPortal: any;
13
14
  }): React.JSX.Element;
14
15
  import React from "react";
@@ -43,15 +43,15 @@ var useHandleClickOutside_1 = require("../../utils/customHooks/useHandleClickOut
43
43
  var usePopOutOfOverflowHiddenParent_1 = require("../../utils/usePopOutOfOverflowHiddenParent");
44
44
  var styled_1 = require("./styled");
45
45
  var ModalConfirmAction_1 = require("../Modals/derivedComps/ModalConfirmAction");
46
+ var react_dom_1 = require("react-dom");
46
47
  //
47
48
  var ActionMenu = function (_a) {
48
- var _b, _c;
49
- var _d = _a.icon, icon = _d === void 0 ? 'DotsThree' : _d, //most likely will never change
50
- invert = _a.invert, actions = _a.actions, _e = _a.align, align = _e === void 0 ? 'right' : _e, _f = _a.iconSize, iconSize = _f === void 0 ? 'S' : _f, M = _a.M, _g = _a.ButtonComp, _ButtonComp = _g === void 0 ? 'ButtonGhost' : _g, setShowActionsInParent = _a.setShowActions, _h = _a.popOutOfOverflowHiddenParent, popOutOfOverflowHiddenParent = _h === void 0 ? false : _h, CustomSelectComp = _a.CustomSelectComp, storybookPreview = _a.storybookPreview //for storybook purposes
51
- ;
49
+ var _b = _a.icon, icon = _b === void 0 ? "DotsThree" : _b, //most likely will never change
50
+ invert = _a.invert, actions = _a.actions, _c = _a.align, align = _c === void 0 ? "right" : _c, _d = _a.iconSize, iconSize = _d === void 0 ? "S" : _d, M = _a.M, _e = _a.ButtonComp, _ButtonComp = _e === void 0 ? "ButtonGhost" : _e, setShowActionsInParent = _a.setShowActions, _f = _a.popOutOfOverflowHiddenParent, popOutOfOverflowHiddenParent = _f === void 0 ? false : _f, CustomSelectComp = _a.CustomSelectComp, storybookPreview = _a.storybookPreview, //for storybook purposes
51
+ useLightboxPortal = _a.useLightboxPortal;
52
52
  var actionMenuRef = (0, react_1.useRef)(null);
53
53
  var optionsWrapperRef = (0, react_1.useRef)(null);
54
- var _j = (0, react_1.useState)(false), showActions = _j[0], setShowActions = _j[1];
54
+ var _g = (0, react_1.useState)(false), showActions = _g[0], setShowActions = _g[1];
55
55
  (0, useHandleClickOutside_1.useHandleClickOutside)(actionMenuRef, setShowActions);
56
56
  if (!actions || actions.length === 0)
57
57
  return null;
@@ -77,25 +77,17 @@ var ActionMenu = function (_a) {
77
77
  (0, react_1.useEffect)(function () {
78
78
  return function () { return setShowActionsInParent && setShowActionsInParent(false); };
79
79
  }, []);
80
- var _k = (0, usePopOutOfOverflowHiddenParent_1.usePopOutOfOverflowHiddenParent)(popOutOfOverflowHiddenParent), fixPos = _k.fixPos, applyFixedPos = _k.applyFixedPos, removeFixedPos = _k.removeFixedPos, trackerRef = _k.trackerRef;
81
- return (react_1.default.createElement(styled_1.StyledActionMenu, { ref: actionMenuRef },
82
- CustomSelectComp
83
- ? react_1.default.createElement(CustomSelectComp, { active: showActions, onClick: function (e) {
84
- setShowActions(!showActions);
85
- } })
86
- : react_1.default.createElement(ButtonComp, __assign({}, buttonSize, { icon: icon, iconSize: iconSize, invert: invert, stopPropagation: true, preventDefault: true, onClick: function (e) {
87
- setShowActions(!showActions);
88
- }, active: showActions })),
89
- popOutOfOverflowHiddenParent &&
90
- react_1.default.createElement(styled_1.StyledActionMenuTracker, { storybookPreview: storybookPreview, align: align, ref: trackerRef }),
91
- react_1.default.createElement(styled_1.StyledActionsDropMenu, __assign({}, {
92
- id: 'dropmenu',
80
+ var _h = (0, usePopOutOfOverflowHiddenParent_1.usePopOutOfOverflowHiddenParent)(popOutOfOverflowHiddenParent), fixPos = _h.fixPos, applyFixedPos = _h.applyFixedPos, removeFixedPos = _h.removeFixedPos, trackerRef = _h.trackerRef;
81
+ var genLighbox = function () {
82
+ var _a, _b;
83
+ return (react_1.default.createElement(styled_1.StyledActionsDropMenu, __assign({}, {
84
+ id: "dropmenu",
93
85
  align: align,
94
86
  invert: invert,
95
- optionsHeight: (_b = getOpsRect()) === null || _b === void 0 ? void 0 : _b.height,
96
- optionsWidth: (_c = getOpsRect()) === null || _c === void 0 ? void 0 : _c.width,
87
+ optionsHeight: (_a = getOpsRect()) === null || _a === void 0 ? void 0 : _a.height,
88
+ optionsWidth: (_b = getOpsRect()) === null || _b === void 0 ? void 0 : _b.width,
97
89
  showActions: showActions,
98
- fixPos: fixPos
90
+ fixPos: fixPos,
99
91
  }),
100
92
  react_1.default.createElement(styled_1.StyledActionMenuOpsWrapper, { invert: invert, align: align, ref: optionsWrapperRef }, actions.map(function (action) {
101
93
  return (react_1.default.createElement(ModalConfirmAction_1.ModalConfirmAction, __assign({}, action.confirmAction),
@@ -107,6 +99,17 @@ var ActionMenu = function (_a) {
107
99
  }, key: action.display, invert: invert }),
108
100
  action.icon && genOptionIcon(action.icon),
109
101
  react_1.default.createElement(Typo_1.SANS_2, null, action.display))));
110
- })))));
102
+ }))));
103
+ };
104
+ return (react_1.default.createElement(styled_1.StyledActionMenu, { ref: actionMenuRef },
105
+ CustomSelectComp ? (react_1.default.createElement(CustomSelectComp, { active: showActions, onClick: function (e) {
106
+ setShowActions(!showActions);
107
+ } })) : (react_1.default.createElement(ButtonComp, __assign({}, buttonSize, { icon: icon, iconSize: iconSize, invert: invert, stopPropagation: true, preventDefault: true, onClick: function (e) {
108
+ setShowActions(!showActions);
109
+ }, active: showActions }))),
110
+ popOutOfOverflowHiddenParent && (react_1.default.createElement(styled_1.StyledActionMenuTracker, { storybookPreview: storybookPreview, align: align, ref: trackerRef })),
111
+ popOutOfOverflowHiddenParent
112
+ ? (0, react_dom_1.createPortal)(genLighbox(), document.getElementById("actionmenu-lightbox-root"))
113
+ : genLighbox()));
111
114
  };
112
115
  exports.ActionMenu = ActionMenu;
@@ -7,6 +7,8 @@ exports.genColor = void 0;
7
7
  var react_1 = __importDefault(require("react"));
8
8
  var genColor = function (_a) {
9
9
  var color = _a.color;
10
+ if (!color)
11
+ return null;
10
12
  return (react_1.default.createElement("div", { style: { flex: "0 0 auto" } },
11
13
  react_1.default.createElement("div", { style: { width: '2rem', height: '2rem', background: color, borderRadius: '10%' } })));
12
14
  };
@@ -26,6 +26,16 @@ Object.defineProperty(exports, "__esModule", { value: true });
26
26
  exports.ModalConfirmAction = void 0;
27
27
  var react_1 = __importStar(require("react"));
28
28
  var ModalConfirm_1 = require("../../ModalConfirm");
29
+ /*
30
+ @description :
31
+ it is a wrapper comp for comps which have a onClick prop ex- button comps. When you click the button,
32
+ it shows a ModalConfirm comp asking for confirmation. If you say "yes" in the ModalConfirm, it does what the button was supposed to do in the first place.
33
+
34
+ VERY IMPORTANT : Wrapping a comp is not enough, the prop enable should be passed as true, which is by default false
35
+
36
+ Check the ModalConfirmAction.stories.js for component usage
37
+
38
+ */
29
39
  function ModalConfirmAction(_a) {
30
40
  var children = _a.children, _b = _a.enabled, enabled = _b === void 0 ? false : _b, _c = _a.title, title = _c === void 0 ? "Are you sure you want to do this action" : _c, subtitle = _a.subtitle, onConfirmText = _a.onConfirmText, onCloseText = _a.onCloseText;
31
41
  var _d = (0, react_1.useState)(false), modal = _d[0], setModal = _d[1];
@@ -0,0 +1,15 @@
1
+ export function ModalSmall({ title, onClose, invert, showActionPanel, onCloseText, onConfirm, onConfirmText, overflowVisible, fitToContentHeight, alignActions, desktopWidth, children }: {
2
+ title: any;
3
+ onClose: any;
4
+ invert: any;
5
+ showActionPanel: any;
6
+ onCloseText?: string;
7
+ onConfirm: any;
8
+ onConfirmText?: string;
9
+ overflowVisible?: boolean;
10
+ fitToContentHeight?: boolean;
11
+ alignActions?: string;
12
+ desktopWidth?: string;
13
+ children: any;
14
+ }): React.JSX.Element;
15
+ import React from "react";
@@ -0,0 +1,13 @@
1
+ "use strict";
2
+ var __importDefault = (this && this.__importDefault) || function (mod) {
3
+ return (mod && mod.__esModule) ? mod : { "default": mod };
4
+ };
5
+ Object.defineProperty(exports, "__esModule", { value: true });
6
+ exports.ModalSmall = void 0;
7
+ var react_1 = __importDefault(require("react"));
8
+ var Modal_1 = require("../../Modal");
9
+ var ModalSmall = function (_a) {
10
+ var title = _a.title, onClose = _a.onClose, invert = _a.invert, showActionPanel = _a.showActionPanel, _b = _a.onCloseText, onCloseText = _b === void 0 ? "Close" : _b, onConfirm = _a.onConfirm, _c = _a.onConfirmText, onConfirmText = _c === void 0 ? "Confirm" : _c, _d = _a.overflowVisible, overflowVisible = _d === void 0 ? true : _d, _e = _a.fitToContentHeight, fitToContentHeight = _e === void 0 ? true : _e, _f = _a.alignActions, alignActions = _f === void 0 ? "right" : _f, _g = _a.desktopWidth, desktopWidth = _g === void 0 ? "50vw" : _g, children = _a.children;
11
+ return (react_1.default.createElement(Modal_1.Modal, { title: title, onClose: onClose, onCloseText: onCloseText, onConfirm: onConfirm, onConfirmText: onConfirmText, desktopWidth: desktopWidth, overflowVisible: overflowVisible, fitToContentHeight: fitToContentHeight, invert: invert, showActionPanel: showActionPanel, alignActions: alignActions, children: react_1.default.createElement("div", { style: { padding: "2rem" } }, children) }));
12
+ };
13
+ exports.ModalSmall = ModalSmall;
@@ -54,7 +54,7 @@ var ColActionsMenu = function (_a) {
54
54
  // cuz if an actionmenu is open we want it to continue showing
55
55
  // on screen irrespective of other factors such as hover and such
56
56
  return (conditionsToRender || actionMenuIsOpen) && (react_1.default.createElement("div", { style: { zIndex: 2, position: 'absolute', top: 0, left: '50%', transform: 'translate(-50%, -50%)' } },
57
- react_1.default.createElement(ActionMenu_1.ActionMenu, { setShowActions: function (bool) { return setActionMenuIsOpen(bool); }, align: "left", CustomSelectComp: function (_a) {
57
+ react_1.default.createElement(ActionMenu_1.ActionMenu, { popOutOfOverflowHiddenParent: true, setShowActions: function (bool) { return setActionMenuIsOpen(bool); }, align: "left", CustomSelectComp: function (_a) {
58
58
  var active = _a.active, onClick = _a.onClick;
59
59
  return (react_1.default.createElement(StyledCustomSelectCompWrapper, { style: { height: colActionsButtonHeight + 'px' }, onClick: onClick, active: active },
60
60
  react_1.default.createElement(DisplayIcon_1.DisplayIcon, { icon: "DotsThree", size: 16 })));
@@ -61,7 +61,7 @@ var RowActionsMenu = function (_a) {
61
61
  left: 0,
62
62
  transform: "translate(-50%, -50%)",
63
63
  } },
64
- react_1.default.createElement(ActionMenu_1.ActionMenu, { align: "left", setShowActions: function (showActions) {
64
+ react_1.default.createElement(ActionMenu_1.ActionMenu, { popOutOfOverflowHiddenParent: true, align: "left", setShowActions: function (showActions) {
65
65
  setActionMenuIsOpen(showActions);
66
66
  }, CustomSelectComp: function (_a) {
67
67
  var active = _a.active, onClick = _a.onClick;
@@ -61,7 +61,7 @@ var useResizeTableColumns = function (_a) {
61
61
  if (!colResizeState) {
62
62
  if (isInDragZone(e)) {
63
63
  e.currentTarget.style.borderRight = borderStyleActive;
64
- e.currentTarget.style.cursor = 'col-resize';
64
+ e.currentTarget.style.setProperty('cursor', 'col-resize', 'important'); // using the setProperty approach only so that we can apply !important
65
65
  }
66
66
  else {
67
67
  e.currentTarget.style.borderRight = borderStyleInactive;
@@ -171,8 +171,8 @@ var TextInput = function (props) {
171
171
  : onBlur, onFocus: onFocus, size: size, autoComplete: "off" }),
172
172
  validationStatus === "loading" && (react_1.default.createElement("div", null,
173
173
  react_1.default.createElement(LoadersAndProgress_1.LoaderCircle, { S: true, invert: invert }))),
174
- clearBtn && (react_1.default.createElement(Buttons_1.ButtonGhost, { M: true, value: clearBtn.text, invert: clearBtn.invert, onClick: function () { return onChange(props.id, ""); }, disabled: !clearBtnEnabled, style: { marginRight: actionBtn ? "-1rem" : "-2rem" }, icon: clearBtn.icon })),
175
- actionBtn && (react_1.default.createElement(Buttons_1.ButtonPrimary, { M: true, value: actionBtn.text, invert: actionBtn.invert, onClick: actionBtnEnabaled && actionBtn.onClick, disabled: !actionBtnEnabaled, style: { marginRight: "-2rem" }, icon: actionBtn.icon }))),
174
+ clearBtn && (react_1.default.createElement(Buttons_1.ButtonGhost, { M: true, value: clearBtn.text, invert: clearBtn.invert, onClick: function () { return onChange(props.id, ""); }, disabled: !clearBtnEnabled, style: { marginRight: actionBtn ? "-1rem" : "-2rem" } })),
175
+ actionBtn && (react_1.default.createElement(Buttons_1.ButtonPrimary, { M: true, value: actionBtn.text, invert: actionBtn.invert, onClick: actionBtnEnabaled && actionBtn.onClick, disabled: !actionBtnEnabaled, style: { marginRight: "-2rem" } }))),
176
176
  (validationStatus === null || validationStatus === void 0 ? void 0 : validationStatus.msg) && (react_1.default.createElement(index_styled_1.MsgContainer, { invert: invert, status: validationStatus === null || validationStatus === void 0 ? void 0 : validationStatus.type },
177
177
  react_1.default.createElement(Typo_1.SANS_3, null,
178
178
  validationStatus.msg,
@@ -40,7 +40,7 @@ var EmbedLinkModal = function (_a) {
40
40
  setShowEmbedLinkModal(false);
41
41
  } },
42
42
  react_1.default.createElement("div", { style: { padding: '2rem' } },
43
- react_1.default.createElement(TextInputs_1.TextInput, { icon: "LinkSimple", onChange: function (k, v) { return setLocalValue(v ? [{ publicUrl: v }] : undefined); }, value: localValue && ((_b = localValue[0]) === null || _b === void 0 ? void 0 : _b.publicUrl), placeholder: "Paste a url here", clearBtn: { icon: 'X' } }),
43
+ react_1.default.createElement(TextInputs_1.TextInput, { icon: "LinkSimple", onChange: function (k, v) { return setLocalValue(v ? [{ publicUrl: v }] : undefined); }, value: localValue && ((_b = localValue[0]) === null || _b === void 0 ? void 0 : _b.publicUrl), placeholder: "Paste a url here", clearBtn: { text: 'clear' } }),
44
44
  localValue && react_1.default.createElement(Paddings_1.PaddingBottom20, null),
45
45
  createVideoPreview({ value: localValue }),
46
46
  react_1.default.createElement(styled_1.StyledModalActionButtons, null,
package/dist/index.d.ts CHANGED
@@ -30,6 +30,7 @@ export { SkeletonLoader } from "./components/LoadersAndProgress/SkeletonLoader";
30
30
  export { ModalConfirm } from "./components/Modals/ModalConfirm";
31
31
  export { ModalForms } from "./components/Modals/derivedComps/ModalForms";
32
32
  export { Modal } from "./components/Modals/Modal";
33
+ export { ModalSmall } from "./components/Modals/derivedComps/ModalSmall";
33
34
  export { EmptyStates } from "./components/EmptyStates";
34
35
  export { HomeCover } from "./components/HomeCover";
35
36
  export { PageScrollIndicator } from "./components/PageScrollIndicator";
package/dist/index.js CHANGED
@@ -17,8 +17,8 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
17
17
  return (mod && mod.__esModule) ? mod : { "default": mod };
18
18
  };
19
19
  Object.defineProperty(exports, "__esModule", { value: true });
20
- exports.BannerAlert = exports.IFrameInput = exports.PDFInput = exports.AudioInput = exports.VideoInput = exports.ProfileImageInput = exports.ImageInput = exports.MetaBlock = exports.HintsProvider = exports.genTagComp = exports.generateOptions = exports.OptionsSingle = exports.DropdownMulti = exports.DropdownSingle = exports.parseCardConfig = exports.ListProfile = exports.CardProfile = exports.CardEmbed = exports.ListContent = exports.CardContent = exports.DateTimeRangePicker = exports.DateTimePicker = exports.TimeRangePicker = exports.TimePicker = exports.DateRangePicker = exports.DatePicker = exports.TextLoader = exports.BarChart = exports.PageScrollIndicator = exports.HomeCover = exports.EmptyStates = exports.Modal = exports.ModalForms = exports.ModalConfirm = exports.SkeletonLoader = exports.Divider = exports.PercentCompletedPie = exports.Accordion = exports.ActionMenu = exports.Tooltip = exports.OKELink = exports.UserRoleBadge = exports.Section = exports.LoaderOverlay = exports.Loader = exports.ProgressBar = exports.LoaderCircle = exports.icons = exports.colors = exports.GlobalStyles = void 0;
21
- exports.styledOKELinkCSS = exports.SimpleTable = exports.ModalConfirmAction = exports.BannerProvider = exports.useBannerContext = exports.BannerContext = exports.BannerInfo = void 0;
20
+ exports.IFrameInput = exports.PDFInput = exports.AudioInput = exports.VideoInput = exports.ProfileImageInput = exports.ImageInput = exports.MetaBlock = exports.HintsProvider = exports.genTagComp = exports.generateOptions = exports.OptionsSingle = exports.DropdownMulti = exports.DropdownSingle = exports.parseCardConfig = exports.ListProfile = exports.CardProfile = exports.CardEmbed = exports.ListContent = exports.CardContent = exports.DateTimeRangePicker = exports.DateTimePicker = exports.TimeRangePicker = exports.TimePicker = exports.DateRangePicker = exports.DatePicker = exports.TextLoader = exports.BarChart = exports.PageScrollIndicator = exports.HomeCover = exports.EmptyStates = exports.ModalSmall = exports.Modal = exports.ModalForms = exports.ModalConfirm = exports.SkeletonLoader = exports.Divider = exports.PercentCompletedPie = exports.Accordion = exports.ActionMenu = exports.Tooltip = exports.OKELink = exports.UserRoleBadge = exports.Section = exports.LoaderOverlay = exports.Loader = exports.ProgressBar = exports.LoaderCircle = exports.icons = exports.colors = exports.GlobalStyles = void 0;
21
+ exports.styledOKELinkCSS = exports.SimpleTable = exports.ModalConfirmAction = exports.BannerProvider = exports.useBannerContext = exports.BannerContext = exports.BannerInfo = exports.BannerAlert = void 0;
22
22
  //css and styling related ( styled-components )
23
23
  var globalStyles_1 = require("./globalStyles");
24
24
  Object.defineProperty(exports, "GlobalStyles", { enumerable: true, get: function () { return globalStyles_1.GlobalStyles; } });
@@ -74,6 +74,8 @@ var ModalForms_1 = require("./components/Modals/derivedComps/ModalForms");
74
74
  Object.defineProperty(exports, "ModalForms", { enumerable: true, get: function () { return ModalForms_1.ModalForms; } });
75
75
  var Modal_1 = require("./components/Modals/Modal");
76
76
  Object.defineProperty(exports, "Modal", { enumerable: true, get: function () { return Modal_1.Modal; } });
77
+ var ModalSmall_1 = require("./components/Modals/derivedComps/ModalSmall");
78
+ Object.defineProperty(exports, "ModalSmall", { enumerable: true, get: function () { return ModalSmall_1.ModalSmall; } });
77
79
  var EmptyStates_1 = require("./components/EmptyStates");
78
80
  Object.defineProperty(exports, "EmptyStates", { enumerable: true, get: function () { return EmptyStates_1.EmptyStates; } });
79
81
  var HomeCover_1 = require("./components/HomeCover");
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "oolib",
3
- "version": "2.89.2",
3
+ "version": "2.90.1",
4
4
  "description": " OKE Component Library",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",