oolib 2.21.3 → 2.23.0

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 (46) hide show
  1. package/dist/components/ActionMenu/index.d.ts +3 -1
  2. package/dist/components/ActionMenu/index.js +22 -5
  3. package/dist/components/ActionMenu/styled.d.ts +1 -0
  4. package/dist/components/ActionMenu/styled.js +43 -14
  5. package/dist/components/ActionMenu/utils/useHandleClickOutside.d.ts +1 -0
  6. package/dist/components/ActionMenu/{utils.js → utils/useHandleClickOutside.js} +3 -3
  7. package/dist/components/ActionMenu/utils/usePopOutOfOverflowHiddenParent.d.ts +6 -0
  8. package/dist/components/ActionMenu/utils/usePopOutOfOverflowHiddenParent.js +65 -0
  9. package/dist/components/Buttons/index.js +2 -2
  10. package/dist/components/Buttons/index.styled.js +4 -4
  11. package/dist/components/LoadersAndProgress/{CircleLoader → LoaderCircle}/index.d.ts +1 -1
  12. package/dist/components/LoadersAndProgress/{CircleLoader → LoaderCircle}/index.js +3 -3
  13. package/dist/components/LoadersAndProgress/index.d.ts +1 -1
  14. package/dist/components/LoadersAndProgress/index.js +3 -3
  15. package/dist/components/RadioAndCheckbox/comps/CheckboxList/comps/CheckboxInput/index.d.ts +4 -4
  16. package/dist/components/RadioAndCheckbox/comps/CheckboxList/comps/CheckboxInput/index.js +7 -13
  17. package/dist/components/RadioAndCheckbox/comps/CheckboxList/comps/CheckboxInput/styled.js +7 -1
  18. package/dist/components/RadioAndCheckbox/comps/CheckboxList/index.d.ts +4 -2
  19. package/dist/components/RadioAndCheckbox/comps/CheckboxList/index.js +78 -32
  20. package/dist/components/RadioAndCheckbox/comps/CheckboxList/styled.d.ts +1 -0
  21. package/dist/components/RadioAndCheckbox/comps/CheckboxList/styled.js +6 -2
  22. package/dist/components/RadioAndCheckbox/comps/RadioList/comps/RadioInput/index.d.ts +2 -3
  23. package/dist/components/RadioAndCheckbox/comps/RadioList/comps/RadioInput/index.js +5 -5
  24. package/dist/components/RadioAndCheckbox/comps/RadioList/comps/RadioInput/styled.js +14 -2
  25. package/dist/components/RadioAndCheckbox/comps/RadioList/index.d.ts +4 -1
  26. package/dist/components/RadioAndCheckbox/comps/RadioList/index.js +67 -27
  27. package/dist/components/RadioAndCheckbox/styled.d.ts +1 -0
  28. package/dist/components/RadioAndCheckbox/styled.js +24 -8
  29. package/dist/components/RadioAndCheckbox/utils.d.ts +12 -0
  30. package/dist/components/RadioAndCheckbox/utils.js +27 -3
  31. package/dist/components/Tags/index.d.ts +2 -1
  32. package/dist/components/Tags/index.js +2 -2
  33. package/dist/components/TextInputs/index.js +1 -1
  34. package/dist/index.d.ts +1 -1
  35. package/dist/index.js +3 -3
  36. package/dist/utils/_EXPORTS/index.d.ts +3 -1
  37. package/dist/utils/_EXPORTS/index.js +8 -3
  38. package/dist/utils/customHooks/useScroll.d.ts +1 -0
  39. package/dist/utils/customHooks/useScroll.js +16 -0
  40. package/dist/utils/formatTextToCamelCase.d.ts +1 -0
  41. package/dist/utils/{genValueFromDisplay.js → formatTextToCamelCase.js} +4 -4
  42. package/dist/utils/toArray.d.ts +1 -0
  43. package/dist/utils/toArray.js +13 -0
  44. package/package.json +1 -1
  45. package/dist/components/ActionMenu/utils.d.ts +0 -1
  46. package/dist/utils/genValueFromDisplay.d.ts +0 -1
@@ -1,4 +1,4 @@
1
- export function ActionMenu({ icon, invert, actions, align, iconSize, ButtonComp: _ButtonComp, setShowActions: setShowActionsInParent }: {
1
+ export function ActionMenu({ icon, invert, actions, align, iconSize, ButtonComp: _ButtonComp, setShowActions: setShowActionsInParent, popOutOfOverflowHiddenParent, storybookPreview }: {
2
2
  icon?: string;
3
3
  invert: any;
4
4
  actions: any;
@@ -6,4 +6,6 @@ export function ActionMenu({ icon, invert, actions, align, iconSize, ButtonComp:
6
6
  iconSize?: string;
7
7
  ButtonComp?: string;
8
8
  setShowActions: any;
9
+ popOutOfOverflowHiddenParent?: boolean;
10
+ storybookPreview: any;
9
11
  }): JSX.Element;
@@ -39,17 +39,19 @@ var react_1 = __importStar(require("react"));
39
39
  var ButtonComps = __importStar(require("../Buttons"));
40
40
  var Typo_1 = require("../Typo");
41
41
  var icons_1 = require("../../icons");
42
- var utils_1 = require("./utils");
42
+ var useHandleClickOutside_1 = require("./utils/useHandleClickOutside");
43
+ var usePopOutOfOverflowHiddenParent_1 = require("./utils/usePopOutOfOverflowHiddenParent");
43
44
  var styled_1 = require("./styled");
44
45
  //
45
46
  var ActionMenu = function (_a) {
46
47
  var _b, _c;
47
48
  var _d = _a.icon, icon = _d === void 0 ? 'DotsThree' : _d, //most likely will never change
48
- invert = _a.invert, actions = _a.actions, _e = _a.align, align = _e === void 0 ? 'right' : _e, _f = _a.iconSize, iconSize = _f === void 0 ? 'S' : _f, _g = _a.ButtonComp, _ButtonComp = _g === void 0 ? 'ButtonGhost' : _g, setShowActionsInParent = _a.setShowActions;
49
+ invert = _a.invert, actions = _a.actions, _e = _a.align, align = _e === void 0 ? 'right' : _e, _f = _a.iconSize, iconSize = _f === void 0 ? 'S' : _f, _g = _a.ButtonComp, _ButtonComp = _g === void 0 ? 'ButtonGhost' : _g, setShowActionsInParent = _a.setShowActions, _h = _a.popOutOfOverflowHiddenParent, popOutOfOverflowHiddenParent = _h === void 0 ? false : _h, storybookPreview = _a.storybookPreview //for storybook purposes
50
+ ;
49
51
  var actionMenuRef = (0, react_1.useRef)(null);
50
52
  var optionsWrapperRef = (0, react_1.useRef)(null);
51
- var _h = (0, react_1.useState)(false), showActions = _h[0], setShowActions = _h[1];
52
- (0, utils_1.useTrackFocus)(actionMenuRef, setShowActions);
53
+ var _j = (0, react_1.useState)(false), showActions = _j[0], setShowActions = _j[1];
54
+ (0, useHandleClickOutside_1.useHandleClickOutside)(actionMenuRef, setShowActions);
53
55
  if (!actions || actions.length === 0)
54
56
  return null;
55
57
  var getOpsRect = function () { var _a; return (_a = optionsWrapperRef.current) === null || _a === void 0 ? void 0 : _a.getBoundingClientRect(); };
@@ -60,17 +62,32 @@ var ActionMenu = function (_a) {
60
62
  };
61
63
  (0, react_1.useEffect)(function () {
62
64
  setShowActionsInParent && setShowActionsInParent(showActions);
65
+ if (popOutOfOverflowHiddenParent) {
66
+ if (showActions)
67
+ applyFixedPos();
68
+ else
69
+ removeFixedPos();
70
+ }
63
71
  }, [showActions]);
72
+ //on unmount, setShowActionsInParent to false, obviously.
73
+ (0, react_1.useEffect)(function () {
74
+ return function () { return setShowActionsInParent && setShowActionsInParent(false); };
75
+ }, []);
76
+ var _k = (0, usePopOutOfOverflowHiddenParent_1.usePopOutOfOverflowHiddenParent)(popOutOfOverflowHiddenParent), fixPos = _k.fixPos, applyFixedPos = _k.applyFixedPos, removeFixedPos = _k.removeFixedPos, trackerRef = _k.trackerRef;
64
77
  return (react_1.default.createElement(styled_1.StyledActionMenu, { ref: actionMenuRef },
65
78
  react_1.default.createElement(ButtonComp, { icon: icon, iconSize: iconSize, invert: invert, stopPropagation: true, onClick: function (e) {
66
79
  setShowActions(!showActions);
67
80
  }, active: showActions }),
81
+ popOutOfOverflowHiddenParent &&
82
+ react_1.default.createElement(styled_1.StyledActionMenuTracker, { storybookPreview: storybookPreview, align: align, ref: trackerRef }),
68
83
  react_1.default.createElement(styled_1.StyledActionsDropMenu, __assign({}, {
84
+ id: 'dropmenu',
69
85
  align: align,
70
86
  invert: invert,
71
87
  optionsHeight: (_b = getOpsRect()) === null || _b === void 0 ? void 0 : _b.height,
72
88
  optionsWidth: (_c = getOpsRect()) === null || _c === void 0 ? void 0 : _c.width,
73
- showActions: showActions
89
+ showActions: showActions,
90
+ fixPos: fixPos
74
91
  }),
75
92
  react_1.default.createElement(styled_1.StyledOptionsWrapper, { invert: invert, align: align, ref: optionsWrapperRef }, actions.map(function (action) {
76
93
  return (react_1.default.createElement(styled_1.StyledOption, __assign({}, action, { onClick: function (ev) {
@@ -1,4 +1,5 @@
1
1
  export const StyledActionMenu: any;
2
+ export const StyledActionMenuTracker: any;
2
3
  export const StyledActionsDropMenu: any;
3
4
  export const StyledOptionsWrapper: any;
4
5
  export const StyledOption: any;
@@ -27,7 +27,7 @@ var __importStar = (this && this.__importStar) || function (mod) {
27
27
  return result;
28
28
  };
29
29
  Object.defineProperty(exports, "__esModule", { value: true });
30
- exports.StyledOption = exports.StyledOptionsWrapper = exports.StyledActionsDropMenu = exports.StyledActionMenu = void 0;
30
+ exports.StyledOption = exports.StyledOptionsWrapper = exports.StyledActionsDropMenu = exports.StyledActionMenuTracker = exports.StyledActionMenu = void 0;
31
31
  var styled_components_1 = __importStar(require("styled-components"));
32
32
  var themes_1 = require("../../themes");
33
33
  var mixins_1 = require("../../themes/mixins");
@@ -42,18 +42,47 @@ var pointerHeight = 10;
42
42
  */
43
43
  var offset = 10;
44
44
  exports.StyledActionMenu = styled_components_1.default.div(templateObject_1 || (templateObject_1 = __makeTemplateObject(["\n position: relative;\n width: max-content;\n"], ["\n position: relative;\n width: max-content;\n"])));
45
- exports.StyledActionsDropMenu = styled_components_1.default.div(templateObject_4 || (templateObject_4 = __makeTemplateObject(["\n position: absolute;\n bottom: 0;\n transform: translateY(100%);\n z-index: 1001;\n transform-origin: left top;\n ", ";\n overflow: hidden;\n width: ", ";\n height: ", ";\n ", "\n"], ["\n position: absolute;\n bottom: 0;\n transform: translateY(100%);\n z-index: 1001;\n transform-origin: left top;\n ", ";\n overflow: hidden;\n width: ", ";\n height: ", ";\n ", "\n"])), (0, mixins_1.transition)("height"), function (_a) {
45
+ var trackerSize = 5;
46
+ exports.StyledActionMenuTracker = styled_components_1.default.div(templateObject_6 || (templateObject_6 = __makeTemplateObject(["\n width: ", "px;\n height: ", "px;\n position: absolute;\n ", "\n bottom: 0;\n transform: translateY(100%);\n ", ";\n"], ["\n width: ", "px;\n height: ", "px;\n position: absolute;\n ", "\n bottom: 0;\n transform: translateY(100%);\n ", ";\n"])), trackerSize, trackerSize, function (_a) {
47
+ var align = _a.align;
48
+ switch (align) {
49
+ case "left":
50
+ return (0, styled_components_1.css)(templateObject_2 || (templateObject_2 = __makeTemplateObject(["\n left: -", "px;\n "], ["\n left: -", "px;\n "])), offset);
51
+ case "right":
52
+ return (0, styled_components_1.css)(templateObject_3 || (templateObject_3 = __makeTemplateObject(["\n right: -", "px;\n "], ["\n right: -", "px;\n "])), offset + trackerSize);
53
+ case "center":
54
+ return (0, styled_components_1.css)(templateObject_4 || (templateObject_4 = __makeTemplateObject(["\n left: 1.5rem; //actionMenu button half width\n "], ["\n left: 1.5rem; //actionMenu button half width\n "])));
55
+ }
56
+ }, function (_a) {
57
+ var storybookPreview = _a.storybookPreview;
58
+ return storybookPreview && (0, styled_components_1.css)(templateObject_5 || (templateObject_5 = __makeTemplateObject([" background-color: ", ""], [" background-color: ", ""])), themes_1.colors.red);
59
+ });
60
+ exports.StyledActionsDropMenu = styled_components_1.default.div(templateObject_13 || (templateObject_13 = __makeTemplateObject(["\n ", "\n\n z-index: 1001;\n\n ", ";\n overflow: hidden;\n width: ", ";\n height: ", ";\n"], ["\n ", "\n\n z-index: 1001;\n\n ", ";\n overflow: hidden;\n width: ", ";\n height: ", ";\n"])), function (_a) {
61
+ var fixPos = _a.fixPos;
62
+ return fixPos
63
+ ? (0, styled_components_1.css)(templateObject_9 || (templateObject_9 = __makeTemplateObject(["\n position: fixed;\n top: ", "px;\n left: ", "px;\n z-index: 1000;\n ", "\n "], ["\n position: fixed;\n top: ", "px;\n left: ", "px;\n z-index: 1000;\n ", "\n "])), fixPos.y, fixPos.x, function (_a) {
64
+ var align = _a.align;
65
+ switch (align) {
66
+ case "center":
67
+ return (0, styled_components_1.css)(templateObject_7 || (templateObject_7 = __makeTemplateObject(["\n transform: translate(-50%, 0);\n "], ["\n transform: translate(-50%, 0);\n "])));
68
+ case "right":
69
+ return (0, styled_components_1.css)(templateObject_8 || (templateObject_8 = __makeTemplateObject(["\n transform: translate(-100%, 0);\n "], ["\n transform: translate(-100%, 0);\n "])));
70
+ }
71
+ }) : (0, styled_components_1.css)(templateObject_12 || (templateObject_12 = __makeTemplateObject(["\n position: absolute;\n bottom: 0;\n transform: translateY(100%);\n transform-origin: left top;\n ", "\n "], ["\n position: absolute;\n bottom: 0;\n transform: translateY(100%);\n transform-origin: left top;\n ", "\n "])), function (_a) {
72
+ var align = _a.align;
73
+ return align === "center"
74
+ ? (0, styled_components_1.css)(templateObject_10 || (templateObject_10 = __makeTemplateObject(["\n left: 1.5rem;\n transform: translate(-50%, 100%);\n "], ["\n left: 1.5rem;\n transform: translate(-50%, 100%);\n "]))) : (0, styled_components_1.css)(templateObject_11 || (templateObject_11 = __makeTemplateObject(["\n ", ": ", "px;\n "], ["\n ", ": ", "px;\n "])), align, 0 - offset);
75
+ });
76
+ }, (0, mixins_1.transition)("height"), function (_a) {
46
77
  var optionsWidth = _a.optionsWidth;
47
- return (optionsWidth + (offset * 2)) + "px";
78
+ return optionsWidth + offset * 2 + "px";
48
79
  }, function (_a) {
49
80
  var showActions = _a.showActions, optionsHeight = _a.optionsHeight;
50
- return showActions ? (optionsHeight + pointerHeight + offset) + "px" || "auto" : 0;
51
- }, function (_a) {
52
- var align = _a.align;
53
- return align == "center"
54
- ? (0, styled_components_1.css)(templateObject_2 || (templateObject_2 = __makeTemplateObject(["\n left: 1.5rem;\n transform: translate(-50%, 100%);\n "], ["\n left: 1.5rem;\n transform: translate(-50%, 100%);\n "]))) : (0, styled_components_1.css)(templateObject_3 || (templateObject_3 = __makeTemplateObject(["\n ", ": ", "px;\n "], ["\n ", ": ", "px;\n "])), align, 0 - offset);
81
+ return showActions
82
+ ? optionsHeight + pointerHeight + offset + "px" || "auto"
83
+ : 0;
55
84
  });
56
- exports.StyledOptionsWrapper = styled_components_1.default.div(templateObject_9 || (templateObject_9 = __makeTemplateObject(["\n position: absolute;\n bottom: 10px;\n padding: 0.6rem 0;\n border: 1px solid ", ";\n background-color: ", ";\n border-radius: 2px;\n box-shadow: 2px 2px 10px rgba(0, 0, 0, 0.05);\n margin: 0 ", "px;\n \n //pointer outline\n &::after {\n content: \"\";\n width: 0;\n height: 0;\n position: absolute;\n bottom: 100%;\n\n ", "\n\n border: 1rem solid transparent;\n border-bottom: 1rem solid\n ", ";\n }\n\n //pointer fill\n &::before {\n content: \"\";\n width: 0;\n height: 0;\n position: absolute;\n bottom: 100%;\n ", "\n border: 0.85rem solid transparent;\n border-bottom: 0.85rem solid \n ", ";\n z-index: 1;\n }\n"], ["\n position: absolute;\n bottom: 10px;\n padding: 0.6rem 0;\n border: 1px solid ", ";\n background-color: ", ";\n border-radius: 2px;\n box-shadow: 2px 2px 10px rgba(0, 0, 0, 0.05);\n margin: 0 ", "px;\n \n //pointer outline\n &::after {\n content: \"\";\n width: 0;\n height: 0;\n position: absolute;\n bottom: 100%;\n\n ", "\n\n border: 1rem solid transparent;\n border-bottom: 1rem solid\n ", ";\n }\n\n //pointer fill\n &::before {\n content: \"\";\n width: 0;\n height: 0;\n position: absolute;\n bottom: 100%;\n ", "\n border: 0.85rem solid transparent;\n border-bottom: 0.85rem solid \n ", ";\n z-index: 1;\n }\n"])), function (_a) {
85
+ exports.StyledOptionsWrapper = styled_components_1.default.div(templateObject_18 || (templateObject_18 = __makeTemplateObject(["\n position: absolute;\n bottom: 10px;\n padding: 0.6rem 0;\n border: 1px solid ", ";\n background-color: ", ";\n border-radius: 2px;\n box-shadow: 2px 2px 10px rgba(0, 0, 0, 0.05);\n margin: 0 ", "px;\n\n //pointer outline\n &::after {\n content: \"\";\n width: 0;\n height: 0;\n position: absolute;\n bottom: 100%;\n\n ", "\n\n border: 1rem solid transparent;\n border-bottom: 1rem solid\n ", ";\n }\n\n //pointer fill\n &::before {\n content: \"\";\n width: 0;\n height: 0;\n position: absolute;\n bottom: 100%;\n ", "\n border: 0.85rem solid transparent;\n border-bottom: 0.85rem solid\n ", ";\n z-index: 1;\n }\n"], ["\n position: absolute;\n bottom: 10px;\n padding: 0.6rem 0;\n border: 1px solid ", ";\n background-color: ", ";\n border-radius: 2px;\n box-shadow: 2px 2px 10px rgba(0, 0, 0, 0.05);\n margin: 0 ", "px;\n\n //pointer outline\n &::after {\n content: \"\";\n width: 0;\n height: 0;\n position: absolute;\n bottom: 100%;\n\n ", "\n\n border: 1rem solid transparent;\n border-bottom: 1rem solid\n ", ";\n }\n\n //pointer fill\n &::before {\n content: \"\";\n width: 0;\n height: 0;\n position: absolute;\n bottom: 100%;\n ", "\n border: 0.85rem solid transparent;\n border-bottom: 0.85rem solid\n ", ";\n z-index: 1;\n }\n"])), function (_a) {
57
86
  var invert = _a.invert;
58
87
  return (invert ? greyColor70 : greyColor5);
59
88
  }, function (_a) {
@@ -62,23 +91,23 @@ exports.StyledOptionsWrapper = styled_components_1.default.div(templateObject_9
62
91
  }, offset, function (_a) {
63
92
  var align = _a.align;
64
93
  return align === "center"
65
- ? (0, styled_components_1.css)(templateObject_5 || (templateObject_5 = __makeTemplateObject(["\n left: 50%;\n transform: translateX(-50%);\n "], ["\n left: 50%;\n transform: translateX(-50%);\n "]))) : (0, styled_components_1.css)(templateObject_6 || (templateObject_6 = __makeTemplateObject(["\n ", ": 0.5rem;\n "], ["\n ", ": 0.5rem;\n "])), align);
94
+ ? (0, styled_components_1.css)(templateObject_14 || (templateObject_14 = __makeTemplateObject(["\n left: 50%;\n transform: translateX(-50%);\n "], ["\n left: 50%;\n transform: translateX(-50%);\n "]))) : (0, styled_components_1.css)(templateObject_15 || (templateObject_15 = __makeTemplateObject(["\n ", ": 0.5rem;\n "], ["\n ", ": 0.5rem;\n "])), align);
66
95
  }, function (_a) {
67
96
  var invert = _a.invert;
68
97
  return (invert ? greyColor70 : greyColor5);
69
98
  }, function (_a) {
70
99
  var align = _a.align;
71
100
  return align === "center"
72
- ? (0, styled_components_1.css)(templateObject_7 || (templateObject_7 = __makeTemplateObject(["\n left: 50%;\n transform: translateX(-50%);\n "], ["\n left: 50%;\n transform: translateX(-50%);\n "]))) : (0, styled_components_1.css)(templateObject_8 || (templateObject_8 = __makeTemplateObject(["\n ", ": 0.65rem;\n "], ["\n ", ": 0.65rem;\n "])), align);
101
+ ? (0, styled_components_1.css)(templateObject_16 || (templateObject_16 = __makeTemplateObject(["\n left: 50%;\n transform: translateX(-50%);\n "], ["\n left: 50%;\n transform: translateX(-50%);\n "]))) : (0, styled_components_1.css)(templateObject_17 || (templateObject_17 = __makeTemplateObject(["\n ", ": 0.65rem;\n "], ["\n ", ": 0.65rem;\n "])), align);
73
102
  }, function (_a) {
74
103
  var invert = _a.invert;
75
104
  return (invert ? greyColor80 : white);
76
105
  });
77
- exports.StyledOption = styled_components_1.default.button(templateObject_10 || (templateObject_10 = __makeTemplateObject(["\n white-space: nowrap;\n border: none;\n cursor: pointer;\n width: 100%;\n display: flex;\n align-items: center;\n gap: 0.5rem;\n text-align: left;\n padding: 0.25rem 1.2rem;\n background-color: transparent;\n color: ", ";\n ", ";\n &:hover {\n background-color: ", ";\n }\n"], ["\n white-space: nowrap;\n border: none;\n cursor: pointer;\n width: 100%;\n display: flex;\n align-items: center;\n gap: 0.5rem;\n text-align: left;\n padding: 0.25rem 1.2rem;\n background-color: transparent;\n color: ", ";\n ", ";\n &:hover {\n background-color: ", ";\n }\n"])), function (_a) {
106
+ exports.StyledOption = styled_components_1.default.button(templateObject_19 || (templateObject_19 = __makeTemplateObject(["\n white-space: nowrap;\n border: none;\n cursor: pointer;\n width: 100%;\n display: flex;\n align-items: center;\n gap: 0.5rem;\n text-align: left;\n padding: 0.25rem 1.2rem;\n background-color: transparent;\n color: ", ";\n ", ";\n &:hover {\n background-color: ", ";\n }\n"], ["\n white-space: nowrap;\n border: none;\n cursor: pointer;\n width: 100%;\n display: flex;\n align-items: center;\n gap: 0.5rem;\n text-align: left;\n padding: 0.25rem 1.2rem;\n background-color: transparent;\n color: ", ";\n ", ";\n &:hover {\n background-color: ", ";\n }\n"])), function (_a) {
78
107
  var invert = _a.invert;
79
108
  return (invert ? white : greyColor100);
80
109
  }, (0, mixins_1.transition)("background-color"), function (_a) {
81
110
  var invert = _a.invert;
82
- return invert ? greyColor70 : greyColor10;
111
+ return (invert ? greyColor70 : greyColor10);
83
112
  });
84
- var templateObject_1, templateObject_2, templateObject_3, templateObject_4, templateObject_5, templateObject_6, templateObject_7, templateObject_8, templateObject_9, templateObject_10;
113
+ var templateObject_1, templateObject_2, templateObject_3, templateObject_4, templateObject_5, templateObject_6, templateObject_7, templateObject_8, templateObject_9, templateObject_10, templateObject_11, templateObject_12, templateObject_13, templateObject_14, templateObject_15, templateObject_16, templateObject_17, templateObject_18, templateObject_19;
@@ -0,0 +1 @@
1
+ export function useHandleClickOutside(ref: any, setShowOptions: any, options?: {}): void;
@@ -1,8 +1,8 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.useTrackFocus = void 0;
3
+ exports.useHandleClickOutside = void 0;
4
4
  var react_1 = require("react");
5
- var useTrackFocus = function (ref, setShowOptions, options) {
5
+ var useHandleClickOutside = function (ref, setShowOptions, options) {
6
6
  if (options === void 0) { options = {}; }
7
7
  var _a = options.enabled, enabled = _a === void 0 ? true : _a;
8
8
  var handleClickOutside = function (event) {
@@ -18,4 +18,4 @@ var useTrackFocus = function (ref, setShowOptions, options) {
18
18
  return function () { return document.removeEventListener('mousedown', handleClickOutside); };
19
19
  }, [enabled]);
20
20
  };
21
- exports.useTrackFocus = useTrackFocus;
21
+ exports.useHandleClickOutside = useHandleClickOutside;
@@ -0,0 +1,6 @@
1
+ export function usePopOutOfOverflowHiddenParent(popOutOfOverflowHiddenParent: any): {
2
+ trackerRef: import("react").MutableRefObject<any>;
3
+ applyFixedPos: () => void;
4
+ removeFixedPos: () => void;
5
+ fixPos: any;
6
+ };
@@ -0,0 +1,65 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.usePopOutOfOverflowHiddenParent = void 0;
4
+ var react_1 = require("react");
5
+ var useScroll_1 = require("../../../utils/customHooks/useScroll");
6
+ //HOW TO USE
7
+ /**
8
+ * this utility is useful when action menus or dropdowns are
9
+ * used inside parents that have overflow hidden.
10
+ *
11
+ * When the dropdown / menu opens, we need it to show,
12
+ * and sometimes its not possible to reposition the dropdown / menu
13
+ * outside of the overflow hidden container.
14
+ *
15
+ * In such cases, we can use this hook.
16
+ * The way to use is this:
17
+ *
18
+ * 1// initiate -> (see what it returns below)
19
+ *
20
+ * 2// attach the ref & pass fixPos as a prop to whatever
21
+ * wrapper is wrapping the menu or dropdown.
22
+ *
23
+ * 3// whereever you are tracking the dropdown/menu opening or closing,
24
+ * there you can write a function to
25
+ * trigger applyFixedPos() when open
26
+ * and removeFixedPos() when closed
27
+ * for example in ActionMenu we can pass a prop called 'setShowActions'
28
+ * which listens to open-close changes
29
+ *
30
+ * And thats it. it should work.
31
+ *
32
+ * Current Usage :
33
+ * 1. In ImageEditor component > to make the ActionMenu stick out of parent
34
+ * 2. In TableRowElem component > to make the ActionMenu stick out of parent
35
+ *
36
+ * Known Issues :
37
+ * 1. If you scroll while the menu is open, it remains fixed to that part of the
38
+ * screen since we are using fixed positioning.
39
+ * 2. When you close the menu, fixed position is removed, so momentarily you see the
40
+ * menu disappearing behind the overflow hidden parent. Minor, but an issue none the less.
41
+ *
42
+ *
43
+ *
44
+ */
45
+ var usePopOutOfOverflowHiddenParent = function (popOutOfOverflowHiddenParent) {
46
+ var trackerRef = (0, react_1.useRef)(null);
47
+ var _a = (0, react_1.useState)(undefined), fixPos = _a[0], setFixPos = _a[1];
48
+ var getBoundingClientRect = function () { var _a; return (_a = trackerRef.current) === null || _a === void 0 ? void 0 : _a.getBoundingClientRect(); };
49
+ var applyFixedPos = function () {
50
+ setFixPos(getBoundingClientRect());
51
+ };
52
+ var updateFixedPos = function (e) {
53
+ /**
54
+ * only if popOut... prop is enabled, AND
55
+ * if an initial fixedPos has been applied,
56
+ * then update it
57
+ */
58
+ if (popOutOfOverflowHiddenParent)
59
+ setFixPos(function (prev) { return prev && getBoundingClientRect(); });
60
+ };
61
+ (0, useScroll_1.useScroll)(updateFixedPos, { noThrottle: true });
62
+ var removeFixedPos = function () { return setFixPos(undefined); };
63
+ return ({ trackerRef: trackerRef, applyFixedPos: applyFixedPos, removeFixedPos: removeFixedPos, fixPos: fixPos });
64
+ };
65
+ exports.usePopOutOfOverflowHiddenParent = usePopOutOfOverflowHiddenParent;
@@ -42,9 +42,9 @@ var lodash_1 = require("lodash");
42
42
  var Typo_1 = require("../Typo");
43
43
  var icons_1 = require("../../icons");
44
44
  var DisplayIcon = function (_a) {
45
- var icon = _a.icon, size = _a.size;
45
+ var icon = _a.icon, size = _a.size, color = _a.color;
46
46
  var IconComp = icons_1.icons[icon];
47
- return react_1.default.createElement(react_1.default.Fragment, null, IconComp && react_1.default.createElement(IconComp, { size: size, weight: "bold" }));
47
+ return react_1.default.createElement(react_1.default.Fragment, null, IconComp && react_1.default.createElement(IconComp, { size: size, color: color, weight: "bold" }));
48
48
  };
49
49
  var ButtonStyledWrapper = function (_a) {
50
50
  var props = _a.props, variant = _a.variant;
@@ -19,7 +19,7 @@ var SIZES = {
19
19
  S: "3rem",
20
20
  M: "4rem",
21
21
  };
22
- var ButtonPrimary = (0, styled_components_2.css)(templateObject_3 || (templateObject_3 = __makeTemplateObject(["\n border: none; // $none;\n background-color: ", ";\n color: ", ";\n ", "\n ", "\n &:hover {\n background-color: ", ";\n color: ", ";\n }\n"], ["\n border: none; // $none;\n background-color: ", ";\n color: ", ";\n ", "\n ", "\n &:hover {\n background-color: ", ";\n color: ", ";\n }\n"])), function (_a) {
22
+ var ButtonPrimary = (0, styled_components_2.css)(templateObject_3 || (templateObject_3 = __makeTemplateObject(["\n border: none; // $none;\n background-color: ", ";\n color: ", ";\n ", "\n ", "\n @media (hover: hover) {\n &:hover {\n background-color: ", ";\n color: ", ";\n }\n }\n"], ["\n border: none; // $none;\n background-color: ", ";\n color: ", ";\n ", "\n ", "\n @media (hover: hover) {\n &:hover {\n background-color: ", ";\n color: ", ";\n }\n }\n"])), function (_a) {
23
23
  var invert = _a.invert, colors = _a.theme.colors;
24
24
  return invert
25
25
  ? (0, utilsOolib_1.getPrimaryColor40)(colors)
@@ -47,7 +47,7 @@ var ButtonPrimary = (0, styled_components_2.css)(templateObject_3 || (templateOb
47
47
  ? greyColor100
48
48
  : (0, utilsOolib_1.getPrimaryColorText)(colors);
49
49
  });
50
- var ButtonSecondary = (0, styled_components_2.css)(templateObject_7 || (templateObject_7 = __makeTemplateObject(["\n border: 2px solid\n ", ";\n background-color: ", ";\n\n color: ", "; \n ", "\n ", "\n ", "\n &:hover {\n background-color: ", ";\n color: ", "; \n }\n"], ["\n border: 2px solid\n ", ";\n background-color: ", ";\n\n color: ", "; \n ", "\n ", "\n ", "\n &:hover {\n background-color: ", ";\n color: ", "; \n }\n"])), function (_a) {
50
+ var ButtonSecondary = (0, styled_components_2.css)(templateObject_7 || (templateObject_7 = __makeTemplateObject(["\n border: 2px solid\n ", ";\n background-color: ", ";\n\n color: ", "; \n ", "\n ", "\n ", "\n @media (hover: hover) {\n &:hover {\n background-color: ", ";\n color: ", "; \n }\n }\n"], ["\n border: 2px solid\n ", ";\n background-color: ", ";\n\n color: ", "; \n ", "\n ", "\n ", "\n @media (hover: hover) {\n &:hover {\n background-color: ", ";\n color: ", "; \n }\n }\n"])), function (_a) {
51
51
  var invert = _a.invert, colors = _a.theme.colors;
52
52
  return invert
53
53
  ? (0, utilsOolib_1.getPrimaryColor40)(colors)
@@ -92,7 +92,7 @@ var ButtonSecondary = (0, styled_components_2.css)(templateObject_7 || (template
92
92
  var colors = _a.theme.colors;
93
93
  return (0, utilsOolib_1.getPrimaryColorText)(colors);
94
94
  });
95
- var ButtonCustom = (0, styled_components_2.css)(templateObject_10 || (templateObject_10 = __makeTemplateObject(["\n border: 2px solid\n ", ";\n box-shadow: -4px 4px 1px\n ", ";\n \n background-color: ", ";\n\n color: ", ";\n\n ", "\n\n ", "\n &:hover {\n background-color: ", ";\n }\n"], ["\n border: 2px solid\n ", ";\n box-shadow: -4px 4px 1px\n ", ";\n \n background-color: ", ";\n\n color: ", ";\n\n ", "\n\n ", "\n &:hover {\n background-color: ", ";\n }\n"])), function (_a) {
95
+ var ButtonCustom = (0, styled_components_2.css)(templateObject_10 || (templateObject_10 = __makeTemplateObject(["\n border: 2px solid\n ", ";\n box-shadow: -4px 4px 1px\n ", ";\n \n background-color: ", ";\n\n color: ", ";\n\n ", "\n\n ", "\n @media (hover: hover) {\n &:hover {\n background-color: ", ";\n }\n }\n"], ["\n border: 2px solid\n ", ";\n box-shadow: -4px 4px 1px\n ", ";\n \n background-color: ", ";\n\n color: ", ";\n\n ", "\n\n ", "\n @media (hover: hover) {\n &:hover {\n background-color: ", ";\n }\n }\n"])), function (_a) {
96
96
  var invert = _a.invert, colors = _a.theme.colors;
97
97
  return invert
98
98
  ? (0, utilsOolib_1.getPrimaryColor40)(colors)
@@ -128,7 +128,7 @@ var ButtonCustom = (0, styled_components_2.css)(templateObject_10 || (templateOb
128
128
  ? greyColor80
129
129
  : (0, utilsOolib_1.getPrimaryColor40)(colors);
130
130
  });
131
- var ButtonGhost = (0, styled_components_2.css)(templateObject_14 || (templateObject_14 = __makeTemplateObject(["\n background-color: ", "; //$white;\n color: ", ";\n ", "\n ", "\n\n ", "\n &:hover {\n background-color: ", ";\n }\n"], ["\n background-color: ", "; //$white;\n color: ", ";\n ", "\n ", "\n\n ", "\n &:hover {\n background-color: ", ";\n }\n"])), function (_a) {
131
+ var ButtonGhost = (0, styled_components_2.css)(templateObject_14 || (templateObject_14 = __makeTemplateObject(["\n background-color: ", "; //$white;\n color: ", ";\n ", "\n ", "\n\n ", "\n @media (hover: hover) {\n &:hover {\n background-color: ", ";\n }\n }\n"], ["\n background-color: ", "; //$white;\n color: ", ";\n ", "\n ", "\n\n ", "\n @media (hover: hover) {\n &:hover {\n background-color: ", ";\n }\n }\n"])), function (_a) {
132
132
  var active = _a.active, colors = _a.theme.colors;
133
133
  return active ? (0, utilsOolib_1.getPrimaryColor40)(colors) : "inherit";
134
134
  }, function (_a) {
@@ -1,4 +1,4 @@
1
- export function CircleLoader({ isBlock, blockHeight, L, S, M, ...props }: {
1
+ export function LoaderCircle({ isBlock, blockHeight, L, S, M, ...props }: {
2
2
  [x: string]: any;
3
3
  isBlock?: boolean;
4
4
  blockHeight?: string;
@@ -25,18 +25,18 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
25
25
  return (mod && mod.__esModule) ? mod : { "default": mod };
26
26
  };
27
27
  Object.defineProperty(exports, "__esModule", { value: true });
28
- exports.CircleLoader = void 0;
28
+ exports.LoaderCircle = void 0;
29
29
  var react_1 = __importDefault(require("react"));
30
30
  var styled_components_1 = require("styled-components");
31
31
  var utils_1 = require("../utils");
32
32
  var styled_1 = require("../styled");
33
- function CircleLoader(_a) {
33
+ function LoaderCircle(_a) {
34
34
  var _b = _a.isBlock, isBlock = _b === void 0 ? true : _b, _c = _a.blockHeight, blockHeight = _c === void 0 ? '100%' : _c, L = _a.L, S = _a.S, M = _a.M, props = __rest(_a, ["isBlock", "blockHeight", "L", "S", "M"]);
35
35
  var size = L ? 'L' : S ? 'S' : 'M'; //defaults to M if no L or S, so techinically, the M prop isnt really required..
36
36
  var renderLoaderDiv = function () { return react_1.default.createElement(LoaderDiv, __assign({}, __assign(__assign({}, props), { isBlock: isBlock, size: size }))); };
37
37
  return !isBlock ? (renderLoaderDiv()) : (react_1.default.createElement(styled_1.StyledLoaderOverlay, { blockHeight: blockHeight }, renderLoaderDiv()));
38
38
  }
39
- exports.CircleLoader = CircleLoader;
39
+ exports.LoaderCircle = LoaderCircle;
40
40
  var LoaderDiv = function (_a) {
41
41
  var size = _a.size, children = _a.children, _text = _a.text, debug = _a.debug, invert = _a.invert, isBlock = _a.isBlock;
42
42
  var theme = (0, styled_components_1.useTheme)();
@@ -1,2 +1,2 @@
1
1
  export { ProgressBar } from "./ProgressBar";
2
- export { CircleLoader } from "./CircleLoader";
2
+ export { LoaderCircle } from "./LoaderCircle";
@@ -1,7 +1,7 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.CircleLoader = exports.ProgressBar = void 0;
3
+ exports.LoaderCircle = exports.ProgressBar = void 0;
4
4
  var ProgressBar_1 = require("./ProgressBar");
5
5
  Object.defineProperty(exports, "ProgressBar", { enumerable: true, get: function () { return ProgressBar_1.ProgressBar; } });
6
- var CircleLoader_1 = require("./CircleLoader");
7
- Object.defineProperty(exports, "CircleLoader", { enumerable: true, get: function () { return CircleLoader_1.CircleLoader; } });
6
+ var LoaderCircle_1 = require("./LoaderCircle");
7
+ Object.defineProperty(exports, "LoaderCircle", { enumerable: true, get: function () { return LoaderCircle_1.LoaderCircle; } });
@@ -1,9 +1,9 @@
1
- export function CheckboxInput({ option, id, onChange, S, value, invert, disabled, rightWrongResult, }: {
1
+ export function CheckboxInput({ option, onClick, S, inputStyle, value, invert, disabled, rightWrongResult, }: {
2
2
  option: any;
3
- id: any;
4
- onChange: any;
3
+ onClick: any;
5
4
  S: any;
6
- value: any;
5
+ inputStyle: any;
6
+ value?: any[];
7
7
  invert: any;
8
8
  disabled: any;
9
9
  rightWrongResult: any;
@@ -18,6 +18,7 @@ exports.CheckboxInput = void 0;
18
18
  var react_1 = __importDefault(require("react"));
19
19
  var icons_1 = require("../../../../../../icons");
20
20
  var themes_1 = require("../../../../../../themes");
21
+ var Tags_1 = require("../../../../../Tags");
21
22
  var Typo_1 = require("../../../../../Typo");
22
23
  var styled_1 = require("../../../../styled");
23
24
  var utils_1 = require("../../../../utils");
@@ -25,28 +26,21 @@ var styled_2 = require("./styled");
25
26
  var Check = icons_1.icons.Check, CheckSquare = icons_1.icons.CheckSquare, XSquare = icons_1.icons.XSquare;
26
27
  var white = themes_1.colors.white, green = themes_1.colors.green, red = themes_1.colors.red, greyColor40 = themes_1.colors.greyColor40, greyColor100 = themes_1.colors.greyColor100;
27
28
  var CheckboxInput = function (_a) {
28
- var option = _a.option, id = _a.id, onChange = _a.onChange, S = _a.S, value = _a.value, invert = _a.invert, disabled = _a.disabled, rightWrongResult = _a.rightWrongResult;
29
- var isSelected = !!value.find(function (selOp) { return selOp.value === option.value; });
29
+ var option = _a.option, onClick = _a.onClick, S = _a.S, inputStyle = _a.inputStyle, _b = _a.value, value = _b === void 0 ? [] : _b, invert = _a.invert, disabled = _a.disabled, rightWrongResult = _a.rightWrongResult;
30
+ var isSelected = value.find(function (selOp) { return selOp.value === option.value; });
30
31
  var markingCommand = (0, utils_1.getMarkingCommand)({ option: option, isSelected: isSelected }); // returns undefined if option isn't labeled as 'correct' nor selected
31
- var handleCheckboxClick = function () {
32
- if (!rightWrongResult) { // no toggling if users are being informed of thier choices result
33
- onChange(id, isSelected ?
34
- value.filter(function (selOp) { return selOp.value !== option.value; })
35
- : value.concat(option));
36
- }
37
- };
38
32
  var SuitableTypo = S ? Typo_1.SANS_2 : Typo_1.SANS_3;
39
- return (react_1.default.createElement(styled_1.StyledOption, __assign({}, { rightWrongResult: rightWrongResult, isSelected: isSelected, disabled: disabled, invert: invert }, { onClick: handleCheckboxClick }),
33
+ return inputStyle === 'tagSelect' ? (react_1.default.createElement(Tags_1.TagSelect, __assign({}, { isSelected: isSelected, invert: invert, disabled: disabled }, { onClick: function () { return !disabled && onClick(option, isSelected); }, display: option.display, value: option.value, style: { alignSelf: 'flex-start' } }))) : (react_1.default.createElement(styled_1.StyledOption, __assign({}, { rightWrongResult: rightWrongResult, isSelected: isSelected, disabled: disabled, invert: invert, S: S }, { onClick: function () { return !rightWrongResult && !disabled && onClick(option, isSelected); } }),
40
34
  !rightWrongResult || markingCommand === undefined ?
41
- react_1.default.createElement(styled_2.StyledCheckbox, __assign({ className: "btn" }, { isSelected: isSelected, disabled: disabled, invert: invert }), isSelected && react_1.default.createElement(Check, { weight: "bold", color: invert ? greyColor100 : white, size: 16 }))
35
+ react_1.default.createElement(styled_2.StyledCheckbox, __assign({ className: "btn" }, { isSelected: isSelected, disabled: disabled, invert: invert, S: S }), isSelected && react_1.default.createElement(Check, { weight: "bold", color: invert ? greyColor100 : white, size: 16 }))
42
36
  :
43
37
  ["markCorrect", "revealCorrect"].includes(markingCommand) ?
44
- react_1.default.createElement(CheckSquare, { size: 26, color: green, style: {
38
+ react_1.default.createElement(CheckSquare, { size: S ? 22.5 : 26, color: green, style: {
45
39
  margin: '-7px -2.8px -7px -3.2px',
46
40
  flexShrink: 0
47
41
  } })
48
42
  : // then wrong
49
- react_1.default.createElement(XSquare, { size: 26, color: red, style: {
43
+ react_1.default.createElement(XSquare, { size: S ? 21.5 : 26, color: red, style: {
50
44
  margin: '-7px -2.8px -7px -3.2px',
51
45
  flexShrink: 0
52
46
  } }),
@@ -33,7 +33,13 @@ var utilsOolib_1 = require("../../../../../../utilsOolib");
33
33
  var themes_1 = require("../../../../../../themes");
34
34
  var mixins_1 = require("../../../../../../themes/mixins");
35
35
  var none = themes_1.colors.none, greyColor40 = themes_1.colors.greyColor40;
36
- exports.StyledCheckbox = styled_components_1.default.button(templateObject_2 || (templateObject_2 = __makeTemplateObject(["\n width: 2rem;\n height: 2rem;\n border: none;\n box-shadow: inset 0 0 0 2px ", ";\n border-radius: 2px;\n background-color: ", ";\n cursor: inherit;\n\n ", "\n\n\n ", "\n\n"], ["\n width: 2rem;\n height: 2rem;\n border: none;\n box-shadow: inset 0 0 0 2px ", ";\n border-radius: 2px;\n background-color: ", ";\n cursor: inherit;\n\n ", "\n\n\n ", "\n\n"])), function (_a) {
36
+ exports.StyledCheckbox = styled_components_1.default.button(templateObject_2 || (templateObject_2 = __makeTemplateObject(["\n \n width: ", ";\n height: ", ";\n border: none;\n box-shadow: inset 0 0 0 2px ", ";\n border-radius: 2px;\n background-color: ", ";\n cursor: inherit;\n\n ", "\n\n\n ", "\n\n"], ["\n \n width: ", ";\n height: ", ";\n border: none;\n box-shadow: inset 0 0 0 2px ", ";\n border-radius: 2px;\n background-color: ", ";\n cursor: inherit;\n\n ", "\n\n\n ", "\n\n"])), function (_a) {
37
+ var S = _a.S;
38
+ return S ? '1.7rem' : '2rem';
39
+ }, function (_a) {
40
+ var S = _a.S;
41
+ return S ? '1.7rem' : '2rem';
42
+ }, function (_a) {
37
43
  var colors = _a.theme.colors, disabled = _a.disabled, invert = _a.invert;
38
44
  return disabled ?
39
45
  greyColor40 : invert ? (0, utilsOolib_1.getPrimaryColor40)(colors) : (0, utilsOolib_1.getPrimaryColor100)(colors);
@@ -1,14 +1,16 @@
1
- export function CheckboxList({ id, injectOtherOption, value, onChange, commonIsCorrectDesc, options, optionStyle, rightWrongResult, listType, invert, style, disabled, className, S, readOnly }: {
1
+ export function CheckboxList({ id, injectOtherOption, value: valueProp, onChange, commonIsCorrectDesc, options, saveValueAsString, inputStyle, rightWrongResult, listType, invert, optionsLimit, style, disabled, className, S, readOnly }: {
2
2
  id: any;
3
3
  injectOtherOption?: boolean;
4
4
  value?: any[];
5
5
  onChange: any;
6
6
  commonIsCorrectDesc: any;
7
7
  options: any;
8
- optionStyle: any;
8
+ saveValueAsString: any;
9
+ inputStyle?: string;
9
10
  rightWrongResult: any;
10
11
  listType: any;
11
12
  invert: any;
13
+ optionsLimit?: number;
12
14
  style: any;
13
15
  disabled: any;
14
16
  className: any;