venice-ui 2.1.16 → 2.1.18

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 (29) hide show
  1. package/dist/cjs/Theme/Theme.js +1 -0
  2. package/dist/cjs/components/Button/Button.styles.js +5 -4
  3. package/dist/cjs/components/Card/Card.js +2 -2
  4. package/dist/cjs/components/ElementHeader/ElementHeader.js +2 -2
  5. package/dist/cjs/components/Icons/Icon.js +47 -7
  6. package/dist/cjs/components/Icons/Icon.styles.js +1 -0
  7. package/dist/cjs/components/Tooltip/Tooltip.js +15 -0
  8. package/dist/cjs/components/Tooltip/Tooltip.styles.js +63 -0
  9. package/dist/cjs/components/Tooltip/index.js +17 -0
  10. package/dist/cjs/index.js +1 -0
  11. package/dist/esm/Theme/Theme.js +1 -0
  12. package/dist/esm/components/Button/Button.styles.js +5 -4
  13. package/dist/esm/components/Card/Card.js +2 -2
  14. package/dist/esm/components/ElementHeader/ElementHeader.js +2 -2
  15. package/dist/esm/components/Icons/Icon.js +25 -5
  16. package/dist/esm/components/Icons/Icon.styles.js +1 -0
  17. package/dist/esm/components/Tooltip/Tooltip.js +8 -0
  18. package/dist/esm/components/Tooltip/Tooltip.styles.js +37 -0
  19. package/dist/esm/components/Tooltip/index.js +1 -0
  20. package/dist/esm/index.js +1 -0
  21. package/dist/types/Theme/Theme.d.ts +1 -0
  22. package/dist/types/components/Card/Card.d.ts +1 -0
  23. package/dist/types/components/ElementHeader/ElementHeader.d.ts +1 -0
  24. package/dist/types/components/Icons/Icon.d.ts +1 -0
  25. package/dist/types/components/Tooltip/Tooltip.d.ts +11 -0
  26. package/dist/types/components/Tooltip/Tooltip.styles.d.ts +13 -0
  27. package/dist/types/components/Tooltip/index.d.ts +1 -0
  28. package/dist/types/index.d.ts +1 -0
  29. package/package.json +1 -1
@@ -17,6 +17,7 @@ exports.Theme = {
17
17
  accent_light: (0, polished_1.lighten)(0.2, exports.pallete.accent),
18
18
  black: "#000000",
19
19
  text: '#333333',
20
+ darkGray: ' #222222',
20
21
  gray_1: '#979797',
21
22
  gray_2: "#b7b7b7",
22
23
  gray_3: "#e3e3e3",
@@ -38,13 +38,14 @@ exports.ButtonElement = styled_components_1.default.button `
38
38
  `background-color: transparent;
39
39
  border: none;
40
40
  color: ${p.theme.action};
41
- ${p.errorVariant &&
42
- `color:${p.theme.errorBackgroundColor};
43
- border:none;`}
44
41
  &:disabled{
45
42
  color: ${p.theme.disabledText};
46
- border: 1px solid ${p.theme.disabledText};
47
43
  }
44
+ ${p.errorVariant &&
45
+ `color:${p.theme.errorBackgroundColor};
46
+ border:none;`}
47
+
48
+
48
49
  `}
49
50
 
50
51
  &:hover {
@@ -8,9 +8,9 @@ const react_1 = __importDefault(require("react"));
8
8
  const Card_styles_1 = require("./Card.styles");
9
9
  const ElementHeader_1 = require("../ElementHeader");
10
10
  const Theme_1 = require("../../Theme");
11
- const Card = ({ children, title, actionLabel, theme = Theme_1.mainTheme, iconColor = theme.textColor, iconHoverColor = theme.action, handleClick, handleBack, height, options, shadow = true, headerDivader = false }) => {
11
+ const Card = ({ children, title, actionLabel, theme = Theme_1.mainTheme, iconColor = theme.textColor, iconHoverColor = theme.action, handleClick, handleBack, height, options, shadow = true, headerDivader = false, actionDisabled = false, }) => {
12
12
  return (react_1.default.createElement(Card_styles_1.CardElement, { height: height, shadow: shadow },
13
- (title || actionLabel) && (react_1.default.createElement(ElementHeader_1.ElementHeader, { title: title, actionLabel: actionLabel, handleClick: handleClick, handleBack: handleBack, options: options, theme: theme, iconColor: iconColor, iconHoverColor: iconHoverColor, bottomDivader: headerDivader })),
13
+ (title || actionLabel) && (react_1.default.createElement(ElementHeader_1.ElementHeader, { title: title, actionLabel: actionLabel, handleClick: handleClick, handleBack: handleBack, options: options, theme: theme, iconColor: iconColor, iconHoverColor: iconHoverColor, bottomDivader: headerDivader, actionDisabled: actionDisabled })),
14
14
  react_1.default.createElement(Card_styles_1.CardContent, { soloMode: !title && !actionLabel }, children)));
15
15
  };
16
16
  exports.Card = Card;
@@ -12,7 +12,7 @@ const Theme_1 = require("../../Theme");
12
12
  const Button_1 = require("../Button");
13
13
  const DropdownMenu_1 = require("../DropdownMenu");
14
14
  const ElementHeader_styles_1 = require("./ElementHeader.styles");
15
- const ElementHeader = ({ title, actionLabel = '', handleClose, handleClick, handleBack, children, theme = Theme_1.mainTheme, backgroundColor = theme.contentBackground, iconColor = theme.textColor, iconHoverColor = theme.action, options, bottomDivader = false, }) => {
15
+ const ElementHeader = ({ title, actionLabel = '', handleClose, handleClick, handleBack, children, theme = Theme_1.mainTheme, backgroundColor = theme.contentBackground, iconColor = theme.textColor, iconHoverColor = theme.action, options, bottomDivader = false, actionDisabled = false, }) => {
16
16
  const leftSide = () => {
17
17
  if (title) {
18
18
  return (react_1.default.createElement(ElementHeader_styles_1.TitleWrapper, null,
@@ -30,7 +30,7 @@ const ElementHeader = ({ title, actionLabel = '', handleClose, handleClick, hand
30
30
  }
31
31
  else if (!handleClose && handleClick && actionLabel) {
32
32
  return (react_1.default.createElement(Aligment_1.Aligment, { align: "center", width: "auto" },
33
- react_1.default.createElement(Button_1.Button, { mode: "secondary", text: actionLabel, onClick: () => handleClick() }),
33
+ react_1.default.createElement(Button_1.Button, { mode: "secondary", text: actionLabel, onClick: () => handleClick(), disabled: actionDisabled }),
34
34
  options && (react_1.default.createElement(DropdownMenu_1.DropdownMenu, { options: options, right: true, iconColor: iconColor, position: 'right' }))));
35
35
  }
36
36
  };
@@ -1,24 +1,64 @@
1
1
  "use strict";
2
- var __importDefault = (this && this.__importDefault) || function (mod) {
3
- return (mod && mod.__esModule) ? mod : { "default": mod };
2
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
+ if (k2 === undefined) k2 = k;
4
+ var desc = Object.getOwnPropertyDescriptor(m, k);
5
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
+ desc = { enumerable: true, get: function() { return m[k]; } };
7
+ }
8
+ Object.defineProperty(o, k2, desc);
9
+ }) : (function(o, m, k, k2) {
10
+ if (k2 === undefined) k2 = k;
11
+ o[k2] = m[k];
12
+ }));
13
+ var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
14
+ Object.defineProperty(o, "default", { enumerable: true, value: v });
15
+ }) : function(o, v) {
16
+ o["default"] = v;
17
+ });
18
+ var __importStar = (this && this.__importStar) || function (mod) {
19
+ if (mod && mod.__esModule) return mod;
20
+ var result = {};
21
+ if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
22
+ __setModuleDefault(result, mod);
23
+ return result;
4
24
  };
5
25
  Object.defineProperty(exports, "__esModule", { value: true });
6
26
  exports.Icon = void 0;
7
- const react_1 = __importDefault(require("react"));
27
+ const react_1 = __importStar(require("react"));
8
28
  const Theme_1 = require("../../Theme/Theme");
9
29
  const Icon_styles_1 = require("./Icon.styles");
10
30
  const IconsPath_1 = require("./IconsPath");
31
+ const Tooltip_1 = require("../Tooltip/Tooltip");
11
32
  const Icon = ({ size = 24, name = 'person', right = false, left = false, isActive = false, onClick = undefined, isDisabled = false, noPadding = false, iconColor = isDisabled ? Theme_1.mainTheme.iconDisabledColor : Theme_1.mainTheme.iconColor, iconHoverColor = Theme_1.mainTheme.iconHoverColor, iconBgColor = Theme_1.mainTheme.iconBgColor, iconBgHoverColor = isDisabled
12
33
  ? Theme_1.mainTheme.iconBgColor
13
- : Theme_1.mainTheme.iconBgHoverColor, }) => {
34
+ : Theme_1.mainTheme.iconBgHoverColor, tooltip, }) => {
14
35
  const haveAction = Boolean(onClick);
36
+ const iconRef = (0, react_1.useRef)(null);
37
+ const [showTooltip, setShowTooltip] = (0, react_1.useState)(false);
38
+ const [tooltipPos, setTooltipPos] = (0, react_1.useState)({ top: 0, left: 0 });
39
+ const [showBelow, setShowBelow] = (0, react_1.useState)(false);
40
+ (0, react_1.useEffect)(() => {
41
+ if (showTooltip && iconRef.current) {
42
+ const rect = iconRef.current.getBoundingClientRect();
43
+ const tooltipHeight = 28;
44
+ const spaceAbove = rect.top;
45
+ const spaceBelow = window.innerHeight - rect.bottom;
46
+ setShowBelow(spaceBelow < tooltipHeight && spaceAbove > tooltipHeight);
47
+ setTooltipPos({
48
+ top: showBelow ? rect.bottom : rect.top,
49
+ left: rect.left + rect.width / 2 - 16,
50
+ });
51
+ }
52
+ }, [showTooltip, showBelow]);
15
53
  const handleClick = () => {
16
54
  if (!isDisabled && !!onClick) {
17
55
  onClick();
18
56
  }
19
57
  };
20
- return (react_1.default.createElement(Icon_styles_1.IconElement, { onClick: handleClick, haveAction: haveAction, right: right, left: left, isDisabled: isDisabled, iconColor: iconColor, iconHoverColor: iconHoverColor, iconBgColor: iconBgColor, iconBgHoverColor: iconBgHoverColor, isActive: isActive, noPadding: noPadding },
21
- react_1.default.createElement("svg", { width: size, height: size, viewBox: '0 0 24 24', preserveAspectRatio: "xMidYMid meet", x: "0", y: "0", name: name },
22
- react_1.default.createElement("path", { d: IconsPath_1.iconsPath[name], fill: isActive ? iconHoverColor : iconColor }))));
58
+ return (react_1.default.createElement(react_1.default.Fragment, null,
59
+ react_1.default.createElement(Icon_styles_1.IconElement, { ref: iconRef, onClick: handleClick, haveAction: haveAction, right: right, left: left, isDisabled: isDisabled, iconColor: iconColor, iconHoverColor: iconHoverColor, iconBgColor: iconBgColor, iconBgHoverColor: iconBgHoverColor, isActive: isActive, noPadding: noPadding, onMouseEnter: () => setShowTooltip(true), onMouseLeave: () => setShowTooltip(false) },
60
+ react_1.default.createElement("svg", { width: size, height: size, viewBox: '0 0 24 24', preserveAspectRatio: "xMidYMid meet", x: "0", y: "0", name: name },
61
+ react_1.default.createElement("path", { d: IconsPath_1.iconsPath[name], fill: isActive ? iconHoverColor : iconColor }))),
62
+ tooltip && showTooltip && (react_1.default.createElement(Tooltip_1.Tooltip, { text: tooltip, position: tooltipPos, showBelow: showBelow }))));
23
63
  };
24
64
  exports.Icon = Icon;
@@ -9,6 +9,7 @@ const Theme_1 = require("../../Theme/Theme");
9
9
  exports.IconElement = styled_components_1.default.div `
10
10
  transition: 300ms;
11
11
  box-sizing: border-box;
12
+ position: relative;
12
13
  width: auto;
13
14
  display: inline-flex;
14
15
  border-radius: ${Theme_1.Theme.borderRadius.m};
@@ -0,0 +1,15 @@
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.Tooltip = void 0;
7
+ const react_1 = __importDefault(require("react"));
8
+ const react_dom_1 = require("react-dom");
9
+ const Tooltip_styles_1 = require("./Tooltip.styles");
10
+ const Tooltip = ({ text, position, showBelow }) => {
11
+ return (0, react_dom_1.createPortal)(react_1.default.createElement(Tooltip_styles_1.TooltipWrapper, { position: position, showBelow: showBelow },
12
+ text,
13
+ react_1.default.createElement(Tooltip_styles_1.TooltipPivot, { showBelow: showBelow })), document.body);
14
+ };
15
+ exports.Tooltip = Tooltip;
@@ -0,0 +1,63 @@
1
+ "use strict";
2
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
+ if (k2 === undefined) k2 = k;
4
+ var desc = Object.getOwnPropertyDescriptor(m, k);
5
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
+ desc = { enumerable: true, get: function() { return m[k]; } };
7
+ }
8
+ Object.defineProperty(o, k2, desc);
9
+ }) : (function(o, m, k, k2) {
10
+ if (k2 === undefined) k2 = k;
11
+ o[k2] = m[k];
12
+ }));
13
+ var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
14
+ Object.defineProperty(o, "default", { enumerable: true, value: v });
15
+ }) : function(o, v) {
16
+ o["default"] = v;
17
+ });
18
+ var __importStar = (this && this.__importStar) || function (mod) {
19
+ if (mod && mod.__esModule) return mod;
20
+ var result = {};
21
+ if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
22
+ __setModuleDefault(result, mod);
23
+ return result;
24
+ };
25
+ Object.defineProperty(exports, "__esModule", { value: true });
26
+ exports.TooltipPivot = exports.TooltipWrapper = void 0;
27
+ const styled_components_1 = __importStar(require("styled-components"));
28
+ const Theme_1 = require("../../Theme/Theme");
29
+ exports.TooltipWrapper = styled_components_1.default.div `
30
+ position: absolute;
31
+ top: ${(p) => (p.showBelow ? p.position.top + 8 : p.position.top - 36)}px;
32
+ left: ${(p) => p.position.left}px;
33
+ background: ${Theme_1.Theme.colors.darkGray};
34
+ color: ${Theme_1.Theme.colors.white};
35
+ padding: ${Theme_1.Theme.padding.s} ${Theme_1.Theme.padding.m};
36
+ border-radius: ${Theme_1.Theme.borderRadius.m};
37
+ font-size: ${Theme_1.Theme.fontSize.s};
38
+ z-index: 9999;
39
+ white-space: nowrap;
40
+ box-shadow: 0 2px 8px ${Theme_1.Theme.colors.overlayer};
41
+ pointer-events: none;
42
+ `;
43
+ exports.TooltipPivot = styled_components_1.default.span `
44
+ position: absolute;
45
+ left: 50%;
46
+ transform: translateX(-50%);
47
+ width: 0;
48
+ height: 0;
49
+ border-left: 7px solid transparent;
50
+ border-right: 7px solid transparent;
51
+
52
+ ${({ showBelow }) => showBelow
53
+ ? (0, styled_components_1.css) `
54
+ top: -7px;
55
+ border-bottom: 7px solid #222;
56
+ border-top: none;
57
+ `
58
+ : (0, styled_components_1.css) `
59
+ bottom: -7px;
60
+ border-top: 7px solid #222;
61
+ border-bottom: none;
62
+ `}
63
+ `;
@@ -0,0 +1,17 @@
1
+ "use strict";
2
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
+ if (k2 === undefined) k2 = k;
4
+ var desc = Object.getOwnPropertyDescriptor(m, k);
5
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
+ desc = { enumerable: true, get: function() { return m[k]; } };
7
+ }
8
+ Object.defineProperty(o, k2, desc);
9
+ }) : (function(o, m, k, k2) {
10
+ if (k2 === undefined) k2 = k;
11
+ o[k2] = m[k];
12
+ }));
13
+ var __exportStar = (this && this.__exportStar) || function(m, exports) {
14
+ for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
15
+ };
16
+ Object.defineProperty(exports, "__esModule", { value: true });
17
+ __exportStar(require("./Tooltip"), exports);
package/dist/cjs/index.js CHANGED
@@ -40,4 +40,5 @@ __exportStar(require("./components/Sort"), exports);
40
40
  __exportStar(require("./components/Table"), exports);
41
41
  __exportStar(require("./components/Tile"), exports);
42
42
  __exportStar(require("./components/Toogle"), exports);
43
+ __exportStar(require("./components/Tooltip"), exports);
43
44
  __exportStar(require("./components/Typography"), exports);
@@ -14,6 +14,7 @@ export const Theme = {
14
14
  accent_light: lighten(0.2, pallete.accent),
15
15
  black: "#000000",
16
16
  text: '#333333',
17
+ darkGray: ' #222222',
17
18
  gray_1: '#979797',
18
19
  gray_2: "#b7b7b7",
19
20
  gray_3: "#e3e3e3",
@@ -32,13 +32,14 @@ export const ButtonElement = styled.button `
32
32
  `background-color: transparent;
33
33
  border: none;
34
34
  color: ${p.theme.action};
35
- ${p.errorVariant &&
36
- `color:${p.theme.errorBackgroundColor};
37
- border:none;`}
38
35
  &:disabled{
39
36
  color: ${p.theme.disabledText};
40
- border: 1px solid ${p.theme.disabledText};
41
37
  }
38
+ ${p.errorVariant &&
39
+ `color:${p.theme.errorBackgroundColor};
40
+ border:none;`}
41
+
42
+
42
43
  `}
43
44
 
44
45
  &:hover {
@@ -2,8 +2,8 @@ import React from 'react';
2
2
  import { CardContent, CardElement } from './Card.styles';
3
3
  import { ElementHeader } from '../ElementHeader';
4
4
  import { mainTheme } from '../../Theme';
5
- export const Card = ({ children, title, actionLabel, theme = mainTheme, iconColor = theme.textColor, iconHoverColor = theme.action, handleClick, handleBack, height, options, shadow = true, headerDivader = false }) => {
5
+ export const Card = ({ children, title, actionLabel, theme = mainTheme, iconColor = theme.textColor, iconHoverColor = theme.action, handleClick, handleBack, height, options, shadow = true, headerDivader = false, actionDisabled = false, }) => {
6
6
  return (React.createElement(CardElement, { height: height, shadow: shadow },
7
- (title || actionLabel) && (React.createElement(ElementHeader, { title: title, actionLabel: actionLabel, handleClick: handleClick, handleBack: handleBack, options: options, theme: theme, iconColor: iconColor, iconHoverColor: iconHoverColor, bottomDivader: headerDivader })),
7
+ (title || actionLabel) && (React.createElement(ElementHeader, { title: title, actionLabel: actionLabel, handleClick: handleClick, handleBack: handleBack, options: options, theme: theme, iconColor: iconColor, iconHoverColor: iconHoverColor, bottomDivader: headerDivader, actionDisabled: actionDisabled })),
8
8
  React.createElement(CardContent, { soloMode: !title && !actionLabel }, children)));
9
9
  };
@@ -6,7 +6,7 @@ import { Theme, mainTheme } from '../../Theme';
6
6
  import { Button } from '../Button';
7
7
  import { DropdownMenu } from '../DropdownMenu';
8
8
  import { ElementHeaderWrapper, TitleWrapper } from './ElementHeader.styles';
9
- export const ElementHeader = ({ title, actionLabel = '', handleClose, handleClick, handleBack, children, theme = mainTheme, backgroundColor = theme.contentBackground, iconColor = theme.textColor, iconHoverColor = theme.action, options, bottomDivader = false, }) => {
9
+ export const ElementHeader = ({ title, actionLabel = '', handleClose, handleClick, handleBack, children, theme = mainTheme, backgroundColor = theme.contentBackground, iconColor = theme.textColor, iconHoverColor = theme.action, options, bottomDivader = false, actionDisabled = false, }) => {
10
10
  const leftSide = () => {
11
11
  if (title) {
12
12
  return (React.createElement(TitleWrapper, null,
@@ -24,7 +24,7 @@ export const ElementHeader = ({ title, actionLabel = '', handleClose, handleClic
24
24
  }
25
25
  else if (!handleClose && handleClick && actionLabel) {
26
26
  return (React.createElement(Aligment, { align: "center", width: "auto" },
27
- React.createElement(Button, { mode: "secondary", text: actionLabel, onClick: () => handleClick() }),
27
+ React.createElement(Button, { mode: "secondary", text: actionLabel, onClick: () => handleClick(), disabled: actionDisabled }),
28
28
  options && (React.createElement(DropdownMenu, { options: options, right: true, iconColor: iconColor, position: 'right' }))));
29
29
  }
30
30
  };
@@ -1,17 +1,37 @@
1
- import React from 'react';
1
+ import React, { useRef, useState, useEffect } from 'react';
2
2
  import { mainTheme } from '../../Theme/Theme';
3
3
  import { IconElement } from './Icon.styles';
4
4
  import { iconsPath } from './IconsPath';
5
+ import { Tooltip } from '../Tooltip/Tooltip';
5
6
  export const Icon = ({ size = 24, name = 'person', right = false, left = false, isActive = false, onClick = undefined, isDisabled = false, noPadding = false, iconColor = isDisabled ? mainTheme.iconDisabledColor : mainTheme.iconColor, iconHoverColor = mainTheme.iconHoverColor, iconBgColor = mainTheme.iconBgColor, iconBgHoverColor = isDisabled
6
7
  ? mainTheme.iconBgColor
7
- : mainTheme.iconBgHoverColor, }) => {
8
+ : mainTheme.iconBgHoverColor, tooltip, }) => {
8
9
  const haveAction = Boolean(onClick);
10
+ const iconRef = useRef(null);
11
+ const [showTooltip, setShowTooltip] = useState(false);
12
+ const [tooltipPos, setTooltipPos] = useState({ top: 0, left: 0 });
13
+ const [showBelow, setShowBelow] = useState(false);
14
+ useEffect(() => {
15
+ if (showTooltip && iconRef.current) {
16
+ const rect = iconRef.current.getBoundingClientRect();
17
+ const tooltipHeight = 28;
18
+ const spaceAbove = rect.top;
19
+ const spaceBelow = window.innerHeight - rect.bottom;
20
+ setShowBelow(spaceBelow < tooltipHeight && spaceAbove > tooltipHeight);
21
+ setTooltipPos({
22
+ top: showBelow ? rect.bottom : rect.top,
23
+ left: rect.left + rect.width / 2 - 16,
24
+ });
25
+ }
26
+ }, [showTooltip, showBelow]);
9
27
  const handleClick = () => {
10
28
  if (!isDisabled && !!onClick) {
11
29
  onClick();
12
30
  }
13
31
  };
14
- return (React.createElement(IconElement, { onClick: handleClick, haveAction: haveAction, right: right, left: left, isDisabled: isDisabled, iconColor: iconColor, iconHoverColor: iconHoverColor, iconBgColor: iconBgColor, iconBgHoverColor: iconBgHoverColor, isActive: isActive, noPadding: noPadding },
15
- React.createElement("svg", { width: size, height: size, viewBox: '0 0 24 24', preserveAspectRatio: "xMidYMid meet", x: "0", y: "0", name: name },
16
- React.createElement("path", { d: iconsPath[name], fill: isActive ? iconHoverColor : iconColor }))));
32
+ return (React.createElement(React.Fragment, null,
33
+ React.createElement(IconElement, { ref: iconRef, onClick: handleClick, haveAction: haveAction, right: right, left: left, isDisabled: isDisabled, iconColor: iconColor, iconHoverColor: iconHoverColor, iconBgColor: iconBgColor, iconBgHoverColor: iconBgHoverColor, isActive: isActive, noPadding: noPadding, onMouseEnter: () => setShowTooltip(true), onMouseLeave: () => setShowTooltip(false) },
34
+ React.createElement("svg", { width: size, height: size, viewBox: '0 0 24 24', preserveAspectRatio: "xMidYMid meet", x: "0", y: "0", name: name },
35
+ React.createElement("path", { d: iconsPath[name], fill: isActive ? iconHoverColor : iconColor }))),
36
+ tooltip && showTooltip && (React.createElement(Tooltip, { text: tooltip, position: tooltipPos, showBelow: showBelow }))));
17
37
  };
@@ -3,6 +3,7 @@ import { Theme } from '../../Theme/Theme';
3
3
  export const IconElement = styled.div `
4
4
  transition: 300ms;
5
5
  box-sizing: border-box;
6
+ position: relative;
6
7
  width: auto;
7
8
  display: inline-flex;
8
9
  border-radius: ${Theme.borderRadius.m};
@@ -0,0 +1,8 @@
1
+ import React from 'react';
2
+ import { createPortal } from 'react-dom';
3
+ import { TooltipPivot, TooltipWrapper } from './Tooltip.styles';
4
+ export const Tooltip = ({ text, position, showBelow }) => {
5
+ return createPortal(React.createElement(TooltipWrapper, { position: position, showBelow: showBelow },
6
+ text,
7
+ React.createElement(TooltipPivot, { showBelow: showBelow })), document.body);
8
+ };
@@ -0,0 +1,37 @@
1
+ import styled, { css } from 'styled-components';
2
+ import { Theme } from '../../Theme/Theme';
3
+ export const TooltipWrapper = styled.div `
4
+ position: absolute;
5
+ top: ${(p) => (p.showBelow ? p.position.top + 8 : p.position.top - 36)}px;
6
+ left: ${(p) => p.position.left}px;
7
+ background: ${Theme.colors.darkGray};
8
+ color: ${Theme.colors.white};
9
+ padding: ${Theme.padding.s} ${Theme.padding.m};
10
+ border-radius: ${Theme.borderRadius.m};
11
+ font-size: ${Theme.fontSize.s};
12
+ z-index: 9999;
13
+ white-space: nowrap;
14
+ box-shadow: 0 2px 8px ${Theme.colors.overlayer};
15
+ pointer-events: none;
16
+ `;
17
+ export const TooltipPivot = styled.span `
18
+ position: absolute;
19
+ left: 50%;
20
+ transform: translateX(-50%);
21
+ width: 0;
22
+ height: 0;
23
+ border-left: 7px solid transparent;
24
+ border-right: 7px solid transparent;
25
+
26
+ ${({ showBelow }) => showBelow
27
+ ? css `
28
+ top: -7px;
29
+ border-bottom: 7px solid #222;
30
+ border-top: none;
31
+ `
32
+ : css `
33
+ bottom: -7px;
34
+ border-top: 7px solid #222;
35
+ border-bottom: none;
36
+ `}
37
+ `;
@@ -0,0 +1 @@
1
+ export * from './Tooltip';
package/dist/esm/index.js CHANGED
@@ -24,4 +24,5 @@ export * from './components/Sort';
24
24
  export * from './components/Table';
25
25
  export * from './components/Tile';
26
26
  export * from './components/Toogle';
27
+ export * from './components/Tooltip';
27
28
  export * from './components/Typography';
@@ -13,6 +13,7 @@ export declare const Theme: {
13
13
  accent_light: string;
14
14
  black: string;
15
15
  text: string;
16
+ darkGray: string;
16
17
  gray_1: string;
17
18
  gray_2: string;
18
19
  gray_3: string;
@@ -13,6 +13,7 @@ interface ICardProps {
13
13
  iconHoverColor?: string;
14
14
  shadow?: boolean;
15
15
  headerDivader?: boolean;
16
+ actionDisabled?: boolean;
16
17
  }
17
18
  export declare const Card: FC<ICardProps>;
18
19
  export {};
@@ -13,6 +13,7 @@ interface IElementHeader {
13
13
  options?: IAction[];
14
14
  theme?: any;
15
15
  bottomDivader?: boolean;
16
+ actionDisabled?: boolean;
16
17
  }
17
18
  export declare const ElementHeader: FC<IElementHeader>;
18
19
  export {};
@@ -12,5 +12,6 @@ export interface IIconActionProps {
12
12
  isDisabled?: boolean;
13
13
  isActive?: boolean;
14
14
  noPadding?: boolean;
15
+ tooltip?: string;
15
16
  }
16
17
  export declare const Icon: FC<IIconActionProps>;
@@ -0,0 +1,11 @@
1
+ import { FC } from 'react';
2
+ interface ITooltipProps {
3
+ text: string;
4
+ position: {
5
+ top: number;
6
+ left: number;
7
+ };
8
+ showBelow: boolean;
9
+ }
10
+ export declare const Tooltip: FC<ITooltipProps>;
11
+ export {};
@@ -0,0 +1,13 @@
1
+ interface ITooltipWrapperProps {
2
+ position: {
3
+ top: number;
4
+ left: number;
5
+ };
6
+ showBelow: boolean;
7
+ }
8
+ export declare const TooltipWrapper: import("styled-components").StyledComponent<"div", any, ITooltipWrapperProps, never>;
9
+ interface ITooltipPivotProps {
10
+ showBelow: boolean;
11
+ }
12
+ export declare const TooltipPivot: import("styled-components").StyledComponent<"span", any, ITooltipPivotProps, never>;
13
+ export {};
@@ -0,0 +1 @@
1
+ export * from './Tooltip';
@@ -24,4 +24,5 @@ export * from './components/Sort';
24
24
  export * from './components/Table';
25
25
  export * from './components/Tile';
26
26
  export * from './components/Toogle';
27
+ export * from './components/Tooltip';
27
28
  export * from './components/Typography';
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "venice-ui",
3
- "version": "2.1.16",
3
+ "version": "2.1.18",
4
4
  "description": "Component library",
5
5
  "main": "index.js",
6
6
  "module": "./dist/esm/index.js",