oolib 2.12.1 → 2.12.4

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -57,13 +57,14 @@ var ActionMenu = function (_a) {
57
57
  e.stopPropagation();
58
58
  setShowActions(!showActions);
59
59
  } }),
60
- react_1.default.createElement(styled_1.StyledActionsDropMenu, __assign({ unfolded: showActions }, { align: align, invert: invert }), actions.map(function (action) {
60
+ react_1.default.createElement(styled_1.StyledActionsDropMenu, __assign({ unfold: showActions }, { align: align, invert: invert }), actions.map(function (action) {
61
+ console.log(action);
61
62
  var ActionButton = action.buttonComp || styled_1.StyledActionBtn;
62
- react_1.default.createElement(ActionButton, __assign({}, action.props, { onClick: function (ev) {
63
+ return (react_1.default.createElement(ActionButton, __assign({ style: { justifyContent: 'left' } }, action, { onClick: function (ev) {
63
64
  action.onClick && action.onClick(ev);
64
65
  setShowActions(false);
65
66
  }, key: action.display, invert: invert }),
66
- react_1.default.createElement(Typo_1.SANS_2, null, action.display));
67
+ react_1.default.createElement(Typo_1.SANS_2, null, action.display)));
67
68
  }))));
68
69
  };
69
70
  exports.ActionMenu = ActionMenu;
@@ -34,18 +34,21 @@ var mixins_1 = require("../../themes/mixins");
34
34
  var Buttons_1 = require("../Buttons");
35
35
  var greyColor5 = themes_1.colors.greyColor5, white = themes_1.colors.white, greyColor10 = themes_1.colors.greyColor10, greyColor80 = themes_1.colors.greyColor80;
36
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) {
37
+ exports.StyledActionsDropMenu = styled_components_1.default.div(templateObject_6 || (templateObject_6 = __makeTemplateObject(["\n position: absolute;\n bottom: -5px;\n transform-origin: left top; \n transform: translateY(100%) ", ";\n ", "\n\n ", "\n box-shadow: 2px 2px 10px rgba(0, 0, 0, 0.05);\n border: 1px solid ", ";\n background-color: ", ";\n\n \n\n &::after{\n content: '';\n width: 0;\n height: 0;\n position: absolute;\n bottom: 100%;\n\n ", "\n border: 1rem solid transparent;\n border-bottom: 1rem solid ", ";\n }\n"], ["\n position: absolute;\n bottom: -5px;\n transform-origin: left top; \n transform: translateY(100%) ", ";\n ", "\n\n ", "\n box-shadow: 2px 2px 10px rgba(0, 0, 0, 0.05);\n border: 1px solid ", ";\n background-color: ", ";\n\n \n\n &::after{\n content: '';\n width: 0;\n height: 0;\n position: absolute;\n bottom: 100%;\n\n ", "\n border: 1rem solid transparent;\n border-bottom: 1rem solid ", ";\n }\n"])), function (_a) {
38
+ var unfold = _a.unfold;
39
+ return "scaleY(".concat(Number(unfold), ")");
40
+ }, (0, mixins_1.transition)('transform'), function (_a) {
38
41
  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);
42
+ 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 "])), function (_a) {
43
+ var unfold = _a.unfold;
44
+ return "scaleY(".concat(Number(unfold), ")");
45
+ }) : (0, styled_components_1.css)(templateObject_3 || (templateObject_3 = __makeTemplateObject(["", ": 0;"], ["", ": 0;"])), align);
40
46
  }, greyColor5, function (_a) {
41
47
  var invert = _a.invert;
42
48
  return invert ? greyColor80 : white;
43
49
  }, function (_a) {
44
- var unfolded = _a.unfolded;
45
- return unfolded ? '20rem' : 0;
46
- }, (0, mixins_1.transition)('clip', 0.5), function (_a) {
47
50
  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);
51
+ return align == 'center' ? (0, styled_components_1.css)(templateObject_4 || (templateObject_4 = __makeTemplateObject(["\n left: 50%;\n transform: translateX(-50%);\n "], ["\n left: 50%;\n transform: translateX(-50%);\n "]))) : (0, styled_components_1.css)(templateObject_5 || (templateObject_5 = __makeTemplateObject(["", ": 1rem;"], ["", ": 1rem;"])), align);
49
52
  }, greyColor10);
50
53
  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
54
  var align = _a.align;
@@ -46,13 +46,14 @@ var DisplayIcon = function (_a) {
46
46
  };
47
47
  var ButtonStyledWrapper = function (_a) {
48
48
  var props = _a.props, variant = _a.variant;
49
- var id = props.id, link = props.link, children = props.children, value = props.value, submit = props.submit, icon = props.icon, onClick = props.onClick, onMouseDown = props.onMouseDown, active = props.active, S = props.S, disabled = props.disabled, invert = props.invert, theme = props.theme, width = props.width, onMouseEnter = props.onMouseEnter, onMouseLeave = props.onMouseLeave, color = props.color, style = props.style, className = props.className;
49
+ var id = props.id, link = props.link, children = props.children, value = props.value, submit = props.submit, icon = props.icon, iconAfter = props.iconAfter, onClick = props.onClick, onMouseDown = props.onMouseDown, active = props.active, S = props.S, disabled = props.disabled, invert = props.invert, theme = props.theme, width = props.width, onMouseEnter = props.onMouseEnter, onMouseLeave = props.onMouseLeave, color = props.color, style = props.style, className = props.className;
50
50
  var displayText = (link === null || link === void 0 ? void 0 : link.displayText) || children || value;
51
51
  var size = (S && "S") || 'M';
52
- var composition = icon && displayText ? 'icon+text' : !displayText && 'iconOnly';
52
+ var composition = (icon || iconAfter) && displayText ? 'icon+text' : !displayText && 'iconOnly';
53
53
  return (react_1.default.createElement(index_styled_1.ButtonStyled, { id: id, style: style, className: className, variant: variant, size: size, active: active, invert: invert, disabled: disabled, theme: theme, onMouseEnter: onMouseEnter, onMouseLeave: onMouseLeave, type: submit ? 'submit' : 'button', onClick: onClick, onMouseDown: onMouseDown, composition: composition, width: width, color: color },
54
54
  icon && react_1.default.createElement(DisplayIcon, { icon: icon, size: S ? 15 : 20 }),
55
- displayText && react_1.default.createElement(Typo_1.SANS_3, { semibold: true }, displayText)));
55
+ displayText && react_1.default.createElement(Typo_1.SANS_3, { semibold: true }, displayText),
56
+ iconAfter && react_1.default.createElement(DisplayIcon, { icon: iconAfter, size: S ? 15 : 20 })));
56
57
  };
57
58
  var Button = function (_a) {
58
59
  var props = _a.props, variant = _a.variant;
@@ -1,10 +1,2 @@
1
- export function TabBar({ id, options, value, onChange, updateUrl, style, emptyTabs, queryParamKey }: {
2
- id: any;
3
- options: any;
4
- value: any;
5
- onChange: any;
6
- updateUrl: any;
7
- style: any;
8
- emptyTabs: any;
9
- queryParamKey?: string;
10
- }): JSX.Element;
1
+ export function TabBarStyle1(props: any): JSX.Element;
2
+ export function TabBarStyle2(props: any): JSX.Element;
@@ -1,34 +1,40 @@
1
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
+ };
2
13
  var __importDefault = (this && this.__importDefault) || function (mod) {
3
14
  return (mod && mod.__esModule) ? mod : { "default": mod };
4
15
  };
5
16
  Object.defineProperty(exports, "__esModule", { value: true });
6
- exports.TabBar = void 0;
17
+ exports.TabBarStyle2 = exports.TabBarStyle1 = void 0;
7
18
  var react_1 = __importDefault(require("react"));
8
19
  var Typo_1 = require("../Typo");
9
20
  var index_styled_1 = require("./index.styled");
10
- var react_router_dom_1 = require("react-router-dom");
11
- var TabBar = function (_a) {
12
- var id = _a.id, options = _a.options, value = _a.value, onChange = _a.onChange, updateUrl = _a.updateUrl, style = _a.style, emptyTabs = _a.emptyTabs, _b = _a.queryParamKey, queryParamKey = _b === void 0 ? 'activeTab' : _b;
13
- var history = (0, react_router_dom_1.useHistory)();
14
- var location = (0, react_router_dom_1.useLocation)();
15
- var handleClick = function (value) {
16
- if (updateUrl) {
17
- var params = new URLSearchParams(location.search);
18
- params.set(queryParamKey, JSON.stringify(value));
19
- history.push({
20
- search: params.toString(),
21
- });
22
- }
23
- onChange && onChange(null, value);
21
+ var Base = function (_a) {
22
+ var id = _a.id, options = _a.options, valueProp = _a.value, onChange = _a.onChange, style = _a.style, emptyTabs = _a.emptyTabs, _b = _a.tabBarStyle, tabBarStyle = _b === void 0 ? '1' : _b, saveValueAsString = _a.saveValueAsString;
23
+ var value = saveValueAsString ? options.find(function (d) { return d.value === valueProp; }) : valueProp;
24
+ var handleClick = function (v) {
25
+ onChange && onChange(id, saveValueAsString ? v.value : v);
24
26
  };
25
- return (react_1.default.createElement(index_styled_1.TabBarContainerStyled, { id: id },
26
- react_1.default.createElement(index_styled_1.TabBarRowStyled, { id: id }, options.map(function (op) {
27
- var tabHasError = emptyTabs && emptyTabs.includes(op.value);
28
- var tabIsActive = value && op.value === value.value;
29
- return (react_1.default.createElement(index_styled_1.TabBarTabWrapper, { style1: style === "1", key: op.value, active: tabIsActive, error: tabHasError },
30
- react_1.default.createElement(index_styled_1.TabBarTabStyled, { active: tabIsActive, error: tabHasError, style1: style === "1", onClick: function () { return handleClick(op); } },
31
- react_1.default.createElement(Typo_1.SANS_2, { semibold: style === "1" }, op.display))));
32
- }))));
27
+ return (react_1.default.createElement(index_styled_1.TabBarStyled, { style: style },
28
+ react_1.default.createElement(index_styled_1.TabBarContainerStyled, { id: id },
29
+ react_1.default.createElement(index_styled_1.TabBarRowStyled, { id: id }, options.map(function (op) {
30
+ var tabHasError = emptyTabs && emptyTabs.includes(op.value);
31
+ var tabIsActive = value && op.value === value.value;
32
+ return (react_1.default.createElement(index_styled_1.TabBarTabWrapper, { tabBarStyle: tabBarStyle, key: op.value, active: tabIsActive, error: tabHasError },
33
+ react_1.default.createElement(index_styled_1.TabBarTabStyled, { active: tabIsActive, error: tabHasError, tabBarStyle: tabBarStyle, onClick: function () { return handleClick(op); } },
34
+ react_1.default.createElement(Typo_1.SANS_2, { semibold: tabBarStyle === "1" }, op.display))));
35
+ })))));
33
36
  };
34
- exports.TabBar = TabBar;
37
+ var TabBarStyle1 = function (props) { return react_1.default.createElement(Base, __assign({}, props, { tabBarStyle: "1" })); };
38
+ exports.TabBarStyle1 = TabBarStyle1;
39
+ var TabBarStyle2 = function (props) { return react_1.default.createElement(Base, __assign({}, props, { tabBarStyle: "2" })); };
40
+ exports.TabBarStyle2 = TabBarStyle2;
@@ -1,3 +1,4 @@
1
+ export const TabBarStyled: any;
1
2
  export const TabBarContainerStyled: any;
2
3
  export const TabBarRowStyled: any;
3
4
  export const TabBarTabWrapper: 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.TabBarTabStyled = exports.TabBarTabWrapper = exports.TabBarRowStyled = exports.TabBarContainerStyled = void 0;
30
+ exports.TabBarTabStyled = exports.TabBarTabWrapper = exports.TabBarRowStyled = exports.TabBarContainerStyled = exports.TabBarStyled = 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");
@@ -64,14 +64,21 @@ var tabBarTabStyle2 = (0, styled_components_1.css)(templateObject_9 || (template
64
64
  // border-top: ${({ top }) => top && `0.1rem solid ${greyColor5}`};
65
65
  // border-bottom: ${({ bottom }) => bottom && `0.1rem solid ${greyColor5}`};
66
66
  // `;
67
- exports.TabBarContainerStyled = styled_components_1.default.div(templateObject_10 || (templateObject_10 = __makeTemplateObject(["\n width: fit-content;\n"], ["\n width: fit-content;\n"])));
68
- exports.TabBarRowStyled = styled_components_1.default.div(templateObject_11 || (templateObject_11 = __makeTemplateObject(["\n display: flex;\n"], ["\n display: flex;\n"])));
69
- exports.TabBarTabWrapper = styled_components_1.default.div(templateObject_12 || (templateObject_12 = __makeTemplateObject(["\n ", "\n"], ["\n ", "\n"])), function (_a) {
70
- var style1 = _a.style1;
71
- return (style1 ? tabBarWrapperStyle1 : tabBarWrapperStyle2);
67
+ exports.TabBarStyled = styled_components_1.default.div(templateObject_10 || (templateObject_10 = __makeTemplateObject(["\n background-color: ", ";\n z-index: 1000;\n height: 4rem;\n"], ["\n background-color: ", ";\n z-index: 1000;\n height: 4rem;\n"])), white);
68
+ exports.TabBarContainerStyled = styled_components_1.default.div(templateObject_11 || (templateObject_11 = __makeTemplateObject(["\n width: fit-content;\n height: 100%;\n"], ["\n width: fit-content;\n height: 100%;\n"])));
69
+ exports.TabBarRowStyled = styled_components_1.default.div(templateObject_12 || (templateObject_12 = __makeTemplateObject(["\n display: flex;\n height: 100%;\n"], ["\n display: flex;\n height: 100%;\n"])));
70
+ exports.TabBarTabWrapper = styled_components_1.default.div(templateObject_13 || (templateObject_13 = __makeTemplateObject(["\n ", "\n"], ["\n ", "\n"])), function (_a) {
71
+ var tabBarStyle = _a.tabBarStyle;
72
+ return (tabBarStyle === '1'
73
+ ? tabBarWrapperStyle1
74
+ : tabBarStyle === '2'
75
+ && tabBarWrapperStyle2);
72
76
  });
73
- exports.TabBarTabStyled = styled_components_1.default.button(templateObject_13 || (templateObject_13 = __makeTemplateObject(["\n padding: 0.8rem 2rem;\n cursor: pointer;\n color: ", ";\n background-color: ", ";\n\n border: 0;\n :hover {\n background-color: ", ";\n }\n\n ", "\n"], ["\n padding: 0.8rem 2rem;\n cursor: pointer;\n color: ", ";\n background-color: ", ";\n\n border: 0;\n :hover {\n background-color: ", ";\n }\n\n ", "\n"])), greyColor100, none, none, function (_a) {
74
- var style1 = _a.style1;
75
- return (style1 ? tabBarTabStyle1 : tabBarTabStyle2);
77
+ exports.TabBarTabStyled = styled_components_1.default.button(templateObject_14 || (templateObject_14 = __makeTemplateObject(["\n padding: 0.8rem 2rem;\n cursor: pointer;\n color: ", ";\n background-color: ", ";\n\n border: 0;\n :hover {\n background-color: ", ";\n }\n\n ", "\n"], ["\n padding: 0.8rem 2rem;\n cursor: pointer;\n color: ", ";\n background-color: ", ";\n\n border: 0;\n :hover {\n background-color: ", ";\n }\n\n ", "\n"])), greyColor100, none, none, function (_a) {
78
+ var tabBarStyle = _a.tabBarStyle;
79
+ return (tabBarStyle === '1'
80
+ ? tabBarTabStyle1
81
+ : tabBarStyle === '2'
82
+ && tabBarTabStyle2);
76
83
  });
77
- 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;
84
+ 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;
@@ -1,8 +1,5 @@
1
- export function UserRoleBadge({ role, value, className, theme: { Roles } }: {
1
+ export function UserRoleBadge({ role, value, className }: {
2
2
  role: any;
3
3
  value: any;
4
4
  className: any;
5
- theme: {
6
- Roles: any;
7
- };
8
5
  }): JSX.Element;
@@ -6,17 +6,19 @@ Object.defineProperty(exports, "__esModule", { value: true });
6
6
  exports.UserRoleBadge = void 0;
7
7
  var react_1 = __importDefault(require("react"));
8
8
  var icons_1 = require("../../icons");
9
+ var styled_components_1 = require("styled-components");
9
10
  var BadgeAdmin = icons_1.icons.BadgeAdmin, BadgeSuperAdmin = icons_1.icons.BadgeSuperAdmin, BadgeMod = icons_1.icons.BadgeMod, BadgeVetted = icons_1.icons.BadgeVetted;
10
11
  var UserRoleBadge = function (_a) {
11
12
  var _b;
12
- var role = _a.role, value = _a.value, className = _a.className, Roles = _a.theme.Roles;
13
+ var role = _a.role, value = _a.value, className = _a.className;
13
14
  var badges = {
14
15
  BadgeSuperAdmin: BadgeSuperAdmin,
15
16
  BadgeAdmin: BadgeAdmin,
16
17
  BadgeMod: BadgeMod,
17
18
  BadgeVetted: BadgeVetted
18
19
  };
19
- var iconName = (_b = Roles[value || role]) === null || _b === void 0 ? void 0 : _b.badgeIcon;
20
+ var theme = (0, styled_components_1.useTheme)();
21
+ var iconName = (_b = theme._Roles[value || role]) === null || _b === void 0 ? void 0 : _b.badgeIcon;
20
22
  var Icon = iconName && badges[iconName];
21
23
  return (Icon ?
22
24
  react_1.default.createElement("div", { className: className },
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "oolib",
3
- "version": "2.12.1",
3
+ "version": "2.12.4",
4
4
  "description": " OKE Component Library",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",