oolib 2.11.5 → 2.12.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.
@@ -0,0 +1,8 @@
1
+ export function ActionMenu({ icon, invert, actions, align, buttonText, sideEffect }: {
2
+ icon: any;
3
+ invert: any;
4
+ actions: any;
5
+ align?: string;
6
+ buttonText: any;
7
+ sideEffect: any;
8
+ }): JSX.Element;
@@ -0,0 +1,65 @@
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.ActionMenu = void 0;
38
+ var react_1 = __importStar(require("react"));
39
+ var Buttons_1 = require("../Buttons");
40
+ var Typo_1 = require("../Typo");
41
+ var styled_1 = require("./styled");
42
+ var ActionMenu = function (_a) {
43
+ var icon = _a.icon, invert = _a.invert, actions = _a.actions, _b = _a.align, align = _b === void 0 ? 'left' : _b, buttonText = _a.buttonText, sideEffect = _a.sideEffect;
44
+ var actionMenuRef = (0, react_1.useRef)(null);
45
+ var _c = (0, react_1.useState)(false), showActions = _c[0], setShowActions = _c[1];
46
+ (0, react_1.useEffect)(function () {
47
+ // if you want this click to trigger a sideeffect in parent.
48
+ //e.g in table elem we set table overflow to unset when action menu is open
49
+ sideEffect && sideEffect(showActions);
50
+ }, [showActions]);
51
+ if (!actions || actions.length === 0)
52
+ return null;
53
+ return (react_1.default.createElement(styled_1.StyledActionMenu, { ref: actionMenuRef },
54
+ react_1.default.createElement(Buttons_1.ButtonGhost, { icon: icon || 'DotsThree', children: buttonText, invert: invert, onClick: function (e) {
55
+ e.stopPropagation();
56
+ setShowActions(!showActions);
57
+ } }),
58
+ react_1.default.createElement(styled_1.StyledActionsDropMenu, __assign({ unfolded: showActions }, { align: align, invert: invert }), actions.map(function (action) {
59
+ react_1.default.createElement(styled_1.StyledActionBtn, __assign({}, action.props, { onClick: function (ev) {
60
+ action.onClick && action.onClick;
61
+ }, key: action.display, invert: invert }),
62
+ react_1.default.createElement(Typo_1.SANS_2, null, action.display));
63
+ }))));
64
+ };
65
+ exports.ActionMenu = ActionMenu;
@@ -0,0 +1,3 @@
1
+ export const StyledActionMenu: any;
2
+ export const StyledActionsDropMenu: any;
3
+ export const StyledActionBtn: any;
@@ -0,0 +1,57 @@
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.StyledActionBtn = exports.StyledActionsDropMenu = exports.StyledActionMenu = void 0;
31
+ var styled_components_1 = __importStar(require("styled-components"));
32
+ var themes_1 = require("../../themes");
33
+ var mixins_1 = require("../../themes/mixins");
34
+ var Buttons_1 = require("../Buttons");
35
+ var greyColor5 = themes_1.colors.greyColor5, white = themes_1.colors.white, greyColor10 = themes_1.colors.greyColor10, greyColor80 = themes_1.colors.greyColor80;
36
+ 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"])));
37
+ exports.StyledActionsDropMenu = styled_components_1.default.div(templateObject_6 || (templateObject_6 = __makeTemplateObject(["\n position: absolute;\n bottom: 0;\n transform: translateY(100%);\n ", "\n box-shadow: 2px 2px 10px rgba(0, 0, 0, 0.05);\n z-index: 10000;\n border: 1px solid ", ";\n background-color: ", ";\n\n overflow: hidden; // for clipping animation\n clip: rect( auto, auto, ", ", auto);\n ", "\n\n &::after{\n content: '';\n width: 1rem;\n height: 1rem;\n \n position: absolute;\n top: 0;\n\n transform: translate(0, -100%);\n ", "\n border-style: solid;\n border-color: transparent transparent ", " transparent;\n border-width: 0px 8px 8px 8px\n }\n"], ["\n position: absolute;\n bottom: 0;\n transform: translateY(100%);\n ", "\n box-shadow: 2px 2px 10px rgba(0, 0, 0, 0.05);\n z-index: 10000;\n border: 1px solid ", ";\n background-color: ", ";\n\n overflow: hidden; // for clipping animation\n clip: rect( auto, auto, ", ", auto);\n ", "\n\n &::after{\n content: '';\n width: 1rem;\n height: 1rem;\n \n position: absolute;\n top: 0;\n\n transform: translate(0, -100%);\n ", "\n border-style: solid;\n border-color: transparent transparent ", " transparent;\n border-width: 0px 8px 8px 8px\n }\n"])), function (_a) {
38
+ var align = _a.align;
39
+ return align == 'center' ? (0, styled_components_1.css)(templateObject_2 || (templateObject_2 = __makeTemplateObject(["\n left: 2rem;\n transform: translate(-50%, 100%);\n "], ["\n left: 2rem;\n transform: translate(-50%, 100%);\n "]))) : (0, styled_components_1.css)(templateObject_3 || (templateObject_3 = __makeTemplateObject(["", ": 0;"], ["", ": 0;"])), align);
40
+ }, greyColor5, function (_a) {
41
+ var invert = _a.invert;
42
+ return invert ? greyColor80 : white;
43
+ }, function (_a) {
44
+ var unfolded = _a.unfolded;
45
+ return unfolded ? '20rem' : 0;
46
+ }, (0, mixins_1.transition)('clip', 0.5), function (_a) {
47
+ var align = _a.align;
48
+ return align == 'center' ? (0, styled_components_1.css)(templateObject_4 || (templateObject_4 = __makeTemplateObject(["\n left: 50%;\n transform: translate(-50%, 100%);\n "], ["\n left: 50%;\n transform: translate(-50%, 100%);\n "]))) : (0, styled_components_1.css)(templateObject_5 || (templateObject_5 = __makeTemplateObject(["", ": 1rem;"], ["", ": 1rem;"])), align);
49
+ }, greyColor10);
50
+ exports.StyledActionBtn = (0, styled_components_1.default)(Buttons_1.ButtonGhost)(templateObject_7 || (templateObject_7 = __makeTemplateObject(["\n white-space: nowrap;\n width: 100%;\n text-align: ", ";\n padding: 1rem 1.6rem;\n background-color: transparent;\n color: ", ";\n ", ";\n &:hover{\n background-color: ", ";\n }\n"], ["\n white-space: nowrap;\n width: 100%;\n text-align: ", ";\n padding: 1rem 1.6rem;\n background-color: transparent;\n color: ", ";\n ", ";\n &:hover{\n background-color: ", ";\n }\n"])), function (_a) {
51
+ var align = _a.align;
52
+ return align === 'center' ? 'center' : 'left';
53
+ }, function (_a) {
54
+ var invert = _a.invert;
55
+ return invert ? white : greyColor80;
56
+ }, (0, mixins_1.transition)('background-color'), greyColor10);
57
+ var templateObject_1, templateObject_2, templateObject_3, templateObject_4, templateObject_5, templateObject_6, templateObject_7;
@@ -33,7 +33,7 @@ var Tooltip = function (_a) {
33
33
  return (react_1.default.createElement(styled_1.StyledWrapper, { onMouseEnter: function () { return setShowTooltip(true); }, onMouseLeave: function () { return setShowTooltip(false); } },
34
34
  children,
35
35
  react_1.default.createElement(styled_1.StyledTooltip, { position: position, show: showTooltip, style: style },
36
- react_1.default.createElement(Typo_1.SANS_2, null, text),
36
+ react_1.default.createElement(Typo_1.SANS_2, { light: true, style: { lineHeight: '0.2em' } }, text),
37
37
  react_1.default.createElement(styled_1.StyledArrowOutline, { position: position },
38
38
  react_1.default.createElement(styled_1.StyledArrow, { position: position })))));
39
39
  };
@@ -35,26 +35,26 @@ var util_1 = require("./util");
35
35
  exports.StyledWrapper = styled_components_1.default.div(templateObject_1 || (templateObject_1 = __makeTemplateObject(["\n position: relative; // made this wrapper with styled.component to ensure its\n width: fit-content; // engine will make this 'fit-content' compatible with firefox/safari\n"], ["\n position: relative; // made this wrapper with styled.component to ensure its\n width: fit-content; // engine will make this 'fit-content' compatible with firefox/safari\n"])));
36
36
  var greyColor15 = themes_1.colors.greyColor15, white = themes_1.colors.white;
37
37
  var clipPaths = {
38
- top: "0% 0%, 50% 65.4%, 100% 0%",
39
- bottom: '50% 34.6%, 100% 100%, 0% 100%',
40
- right: '100% 0%, 50% 50%, 100% 100%',
41
- left: '0% 0%, 50% 50%, 0% 100%',
38
+ top: "0% 0%, 47% 65.4%, 52% 65.4%, 100% 0",
39
+ bottom: '47% 34.6%, 50% 34.6%, 100% 100%, 0% 100%',
40
+ right: '100% 0%, 50% 47%, 50% 52%, 100% 100%',
41
+ left: '0% 0%, 50% 47%, 50% 52%, 0% 100%',
42
42
  };
43
- exports.StyledTooltip = styled_components_1.default.div(templateObject_4 || (templateObject_4 = __makeTemplateObject(["\n ", ";\n ", "\n\n padding: 0.4rem 1rem;\n white-space: nowrap;\n background-color: ", ";\n border: 1px solid ", ";\n border-radius: 2px;\n position: absolute;\n ", "\n\n \n"], ["\n ", ";\n ", "\n\n padding: 0.4rem 1rem;\n white-space: nowrap;\n background-color: ", ";\n border: 1px solid ", ";\n border-radius: 2px;\n position: absolute;\n ", "\n\n \n"])), function (_a) {
43
+ exports.StyledTooltip = styled_components_1.default.div(templateObject_4 || (templateObject_4 = __makeTemplateObject(["\n ", ";\n ", "\n\n padding: 0rem 1rem;\n white-space: nowrap;\n background-color: ", ";\n border: 1px solid ", ";\n border-radius: 2px;\n position: absolute;\n ", "\n\n \n"], ["\n ", ";\n ", "\n\n padding: 0rem 1rem;\n white-space: nowrap;\n background-color: ", ";\n border: 1px solid ", ";\n border-radius: 2px;\n position: absolute;\n ", "\n\n \n"])), function (_a) {
44
44
  var show = _a.show;
45
45
  return show ? (0, styled_components_1.css)(templateObject_2 || (templateObject_2 = __makeTemplateObject(["opacity:1; z-index: 5;"], ["opacity:1; z-index: 5;"]))) : (0, styled_components_1.css)(templateObject_3 || (templateObject_3 = __makeTemplateObject(["opacity:0; z-index: -5;"], ["opacity:0; z-index: -5;"])));
46
46
  }, (0, mixins_1.transition)('opacity', 0.1), white, greyColor15, function (_a) {
47
47
  var position = _a.position;
48
48
  return (0, util_1.positionTooltip)(position);
49
49
  });
50
- exports.StyledArrowOutline = styled_components_1.default.span(templateObject_5 || (templateObject_5 = __makeTemplateObject(["\n background-color: ", ";\n width: 1.3rem;\n height: 1.3rem;\n position: absolute;\n clip-path: polygon(", ");\n ", "\n"], ["\n background-color: ", ";\n width: 1.3rem;\n height: 1.3rem;\n position: absolute;\n clip-path: polygon(", ");\n ", "\n"])), greyColor15, function (_a) {
50
+ exports.StyledArrowOutline = styled_components_1.default.span(templateObject_5 || (templateObject_5 = __makeTemplateObject(["\n background-color: ", ";\n width: 1rem;\n height: 1rem;\n position: absolute;\n clip-path: polygon(", ");\n ", "\n"], ["\n background-color: ", ";\n width: 1rem;\n height: 1rem;\n position: absolute;\n clip-path: polygon(", ");\n ", "\n"])), greyColor15, function (_a) {
51
51
  var position = _a.position;
52
52
  return clipPaths[position];
53
53
  }, function (_a) {
54
54
  var position = _a.position;
55
55
  return (0, util_1.positionArrowBorder)(position);
56
56
  });
57
- exports.StyledArrow = styled_components_1.default.span(templateObject_6 || (templateObject_6 = __makeTemplateObject([" // the the white part\n background-color: ", ";\n display:inline-block;\n width: 0.9rem;\n height: 0.9rem;\n position: absolute;\n clip-path: polygon(", ");\n ", "\n"], [" // the the white part\n background-color: ", ";\n display:inline-block;\n width: 0.9rem;\n height: 0.9rem;\n position: absolute;\n clip-path: polygon(", ");\n ", "\n"])), white, function (_a) {
57
+ exports.StyledArrow = styled_components_1.default.span(templateObject_6 || (templateObject_6 = __makeTemplateObject([" // the the white part\n background-color: ", ";\n display:inline-block;\n width: 0.85rem;\n height: 0.85rem;\n position: absolute;\n clip-path: polygon(", ");\n ", "\n"], [" // the the white part\n background-color: ", ";\n display:inline-block;\n width: 0.85rem;\n height: 0.85rem;\n position: absolute;\n clip-path: polygon(", ");\n ", "\n"])), white, function (_a) {
58
58
  var position = _a.position;
59
59
  return clipPaths[position];
60
60
  }, function (_a) {
@@ -21,10 +21,10 @@ var positionArrowBorder = function (position) {
21
21
  switch (position) {
22
22
  case 'top':
23
23
  case 'bottom':
24
- return (0, styled_components_1.css)(templateObject_3 || (templateObject_3 = __makeTemplateObject(["\n ", ";\n left: 50%;\n transform: translateX(-6.5px); // 13/2 \n "], ["\n ", ";\n left: 50%;\n transform: translateX(-6.5px); // 13/2 \n "])), position + ': 100.5%');
24
+ return (0, styled_components_1.css)(templateObject_3 || (templateObject_3 = __makeTemplateObject(["\n ", ";\n left: 50%;\n transform: translateX(-5px); // 13/2 - 1.5 of the arrow itself \n "], ["\n ", ";\n left: 50%;\n transform: translateX(-5px); // 13/2 - 1.5 of the arrow itself \n "])), position + ': 100%');
25
25
  case 'left':
26
26
  case 'right':
27
- return (0, styled_components_1.css)(templateObject_4 || (templateObject_4 = __makeTemplateObject(["\n ", ";\n top: 50%;\n transform: translateY(-6.5px); // 13/2\n "], ["\n ", ";\n top: 50%;\n transform: translateY(-6.5px); // 13/2\n "])), position + ': 100.5%');
27
+ return (0, styled_components_1.css)(templateObject_4 || (templateObject_4 = __makeTemplateObject(["\n ", ";\n top: 50%;\n transform: translateY(-5px); // 13/2\n "], ["\n ", ";\n top: 50%;\n transform: translateY(-5px); // 13/2\n "])), position + ': 100%');
28
28
  }
29
29
  };
30
30
  exports.positionArrowBorder = positionArrowBorder;
@@ -32,10 +32,10 @@ var positionArrow = function (position) {
32
32
  switch (position) {
33
33
  case 'top':
34
34
  case 'bottom':
35
- return (0, styled_components_1.css)(templateObject_5 || (templateObject_5 = __makeTemplateObject(["\n ", ";\n left: 14%;\n "], ["\n ", ";\n left: 14%;\n "])), position + ': 9%');
35
+ return (0, styled_components_1.css)(templateObject_5 || (templateObject_5 = __makeTemplateObject(["\n ", ";\n left: 8%;\n "], ["\n ", ";\n left: 8%;\n "])), position + ': -2%');
36
36
  case 'left':
37
37
  case 'right':
38
- return (0, styled_components_1.css)(templateObject_6 || (templateObject_6 = __makeTemplateObject(["\n ", ";\n top: 14%;\n "], ["\n ", ";\n top: 14%;\n "])), position + ': 7%');
38
+ return (0, styled_components_1.css)(templateObject_6 || (templateObject_6 = __makeTemplateObject(["\n ", ";\n top: 8%;\n "], ["\n ", ";\n top: 8%;\n "])), position + ': -2%');
39
39
  }
40
40
  };
41
41
  exports.positionArrow = positionArrow;
package/dist/index.d.ts CHANGED
@@ -19,3 +19,4 @@ export { Section } from "./components/Section";
19
19
  export { UserRoleBadge } from "./components/UserRoleBadge";
20
20
  export { OKELink } from "./components/OKELink";
21
21
  export { Tooltip } from "./components/Tooltip";
22
+ export { ActionMenu } from "./components/ActionMenu";
package/dist/index.js CHANGED
@@ -14,7 +14,7 @@ var __exportStar = (this && this.__exportStar) || function(m, exports) {
14
14
  for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
15
15
  };
16
16
  Object.defineProperty(exports, "__esModule", { value: true });
17
- exports.Tooltip = exports.OKELink = exports.UserRoleBadge = exports.Section = exports.icons = exports.colors = exports.GlobalStyles = void 0;
17
+ exports.ActionMenu = exports.Tooltip = exports.OKELink = exports.UserRoleBadge = exports.Section = exports.icons = exports.colors = exports.GlobalStyles = void 0;
18
18
  var globalStyles_1 = require("./globalStyles");
19
19
  Object.defineProperty(exports, "GlobalStyles", { enumerable: true, get: function () { return globalStyles_1.GlobalStyles; } });
20
20
  __exportStar(require("./components/Typo"), exports);
@@ -40,6 +40,8 @@ var OKELink_1 = require("./components/OKELink");
40
40
  Object.defineProperty(exports, "OKELink", { enumerable: true, get: function () { return OKELink_1.OKELink; } });
41
41
  var Tooltip_1 = require("./components/Tooltip");
42
42
  Object.defineProperty(exports, "Tooltip", { enumerable: true, get: function () { return Tooltip_1.Tooltip; } });
43
+ var ActionMenu_1 = require("./components/ActionMenu");
44
+ Object.defineProperty(exports, "ActionMenu", { enumerable: true, get: function () { return ActionMenu_1.ActionMenu; } });
43
45
  __exportStar(require("./components/TabBar"), exports);
44
46
  __exportStar(require("./components/Banners"), exports);
45
47
  __exportStar(require("./themes/mixins"), exports);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "oolib",
3
- "version": "2.11.5",
3
+ "version": "2.12.0",
4
4
  "description": " OKE Component Library",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",