@cyber-harbour/ui 1.0.59 → 1.0.60

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.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@cyber-harbour/ui",
3
- "version": "1.0.59",
3
+ "version": "1.0.60",
4
4
  "main": "dist/index.js",
5
5
  "module": "dist/index.mjs",
6
6
  "types": "dist/index.d.ts",
@@ -0,0 +1,16 @@
1
+ import { SVGProps } from 'react';
2
+
3
+ interface PencilIconProps extends SVGProps<SVGSVGElement> {
4
+ fill?: string;
5
+ }
6
+
7
+ export const PencilIcon = ({ fill = 'currentColor', ...props }: PencilIconProps) => {
8
+ return (
9
+ <svg viewBox="0 0 18 17" fill="none" xmlns="http://www.w3.org/2000/svg" {...props}>
10
+ <path
11
+ d="M2.35001 13.0753L1.14265 16.0938C1.10786 16.1808 1.09934 16.276 1.11816 16.3677C1.13697 16.4595 1.18229 16.5437 1.2485 16.6099C1.31471 16.6761 1.3989 16.7214 1.49063 16.7402C1.58235 16.7591 1.67758 16.7505 1.76451 16.7157L4.7829 15.5083C5.26418 15.3157 5.7013 15.0273 6.06775 14.6606L16.514 4.21473C16.8946 3.83411 17.1084 3.31787 17.1084 2.77959C17.1084 2.24131 16.8946 1.72508 16.514 1.34445C16.1334 0.963831 15.6172 0.75 15.0789 0.75C14.5407 0.75 14.0245 0.963831 13.6439 1.34445L3.19669 11.7903C2.83038 12.1569 2.54233 12.5941 2.35001 13.0753Z"
12
+ fill={fill}
13
+ />
14
+ </svg>
15
+ );
16
+ };
@@ -0,0 +1,16 @@
1
+ import { SVGProps } from 'react';
2
+
3
+ interface PointIconProps extends SVGProps<SVGSVGElement> {
4
+ fill?: string;
5
+ }
6
+
7
+ export const PointIcon = ({ fill = 'currentColor', ...props }: PointIconProps) => {
8
+ return (
9
+ <svg viewBox="0 0 61 32" fill="none" xmlns="http://www.w3.org/2000/svg" {...props}>
10
+ <path
11
+ d="M28.928 0.067c-2.381 0.235-4.176 0.755-6.115 1.776-2.601 1.422-4.71 3.453-6.186 5.908l-0.041 0.073c-1.272 2.189-2.072 4.794-2.199 7.574l-0.001 0.037-0.024 0.563-14.363 0.053v2.555h14.568l0.187 0.843c0.533 2.37 1.51 4.453 2.845 6.255l-0.032-0.045c0.741 1.011 2.421 2.664 3.453 3.4 4.011 2.851 9.149 3.661 13.709 2.157 1.337-0.488 2.474-1.026 3.552-1.653l-0.104 0.056c1.138-0.744 2.128-1.568 3.013-2.493l0.006-0.006c2.011-2.12 3.264-4.432 3.987-7.341l0.28-1.123 15.869-0.053v-2.555h-15.613l-0.064-0.317c-0.041-0.24-0.064-0.517-0.064-0.8 0-0.009 0-0.017 0-0.026v0.001c0-1.613-0.709-4.248-1.661-6.168-1.366-2.619-3.317-4.766-5.689-6.324l-0.063-0.039c-0.975-0.572-2.112-1.11-3.298-1.546l-0.15-0.048c-1.789-0.592-4.123-0.877-5.803-0.715zM32.557 2.912c5.315 1.128 9.392 5.459 10.293 10.931 0.155 0.933 0.155 3.379 0 4.309-0.654 3.884-2.877 7.151-5.983 9.181l-0.052 0.032c-4.117 2.645-9.627 2.605-13.739-0.101-4.149-2.733-6.389-7.357-5.995-12.371 0.483-6.133 4.989-11.109 10.939-12.085 1.109-0.181 3.445-0.128 4.536 0.104z"
12
+ fill={fill}
13
+ />
14
+ </svg>
15
+ );
16
+ };
@@ -57,3 +57,5 @@ export { FolderAlertIcon } from './FolderAlertIcon';
57
57
  export { RelationIcon } from './RelationIcon';
58
58
  export { RelationPointsIcon } from './RelationPointsIcon';
59
59
  export { PassportIcon } from './PassportIcon';
60
+ export { PointIcon } from './PointIcon';
61
+ export { PencilIcon } from './PencilIcon';
@@ -0,0 +1,99 @@
1
+ import { useCallback, useState } from 'react';
2
+ import { Popover, PopoverAlign, PopoverPosition } from 'react-tiny-popover';
3
+ import { pxToRem } from '../../Theme';
4
+ import { styled } from 'styled-components';
5
+
6
+ interface TooltipProps {
7
+ className?: string;
8
+ children?: any;
9
+ content?: any;
10
+ positions?: PopoverPosition[] | PopoverPosition;
11
+ align?: PopoverAlign;
12
+ anchorClassName?: string;
13
+ offset?: number;
14
+ }
15
+
16
+ export const Tooltip = ({
17
+ className,
18
+ positions = ['top'],
19
+ align = 'center',
20
+ anchorClassName,
21
+ content,
22
+ offset = 6,
23
+ children,
24
+ }: TooltipProps) => {
25
+ const [isOpen, setIsOpen] = useState<boolean>(false);
26
+
27
+ const position = Array.isArray(positions) ? positions[0] : positions;
28
+
29
+ const handleMouseEnter = useCallback(() => {
30
+ if (content) setIsOpen(true);
31
+ }, [content]);
32
+
33
+ const handleMouseLeave = useCallback(() => {
34
+ setIsOpen(false);
35
+ }, []);
36
+
37
+ return (
38
+ <Popover
39
+ padding={offset}
40
+ positions={positions}
41
+ isOpen={isOpen}
42
+ align={align}
43
+ content={
44
+ !!content && (
45
+ <StyledContent className={className} $position={position} $offset={offset}>
46
+ {content}
47
+ </StyledContent>
48
+ )
49
+ }
50
+ containerStyle={{
51
+ zIndex: `${9999}`,
52
+ }}
53
+ >
54
+ <StyledAnchor onMouseEnter={handleMouseEnter} onMouseLeave={handleMouseLeave} className={anchorClassName}>
55
+ {children}
56
+ </StyledAnchor>
57
+ </Popover>
58
+ );
59
+ };
60
+ const StyledAnchor = styled.div`
61
+ display: inline-block;
62
+ `;
63
+
64
+ const StyledContent = styled.div<{ $position: PopoverPosition; $offset: number }>(
65
+ ({ theme, $position, $offset }) => `
66
+ padding: ${theme.tooltip.padding};
67
+ max-width: ${theme.tooltip.maxWidth};
68
+ border-radius: ${theme.tooltip.borderRadius};
69
+ background: ${theme.tooltip.background};
70
+ box-shadow: ${theme.tooltip.shadow};
71
+
72
+ color: ${theme.tooltip.color};
73
+ font-size: ${theme.tooltip.fontSize};
74
+ line-height: 1.4;
75
+ word-break: break-word;
76
+ white-space: pre-line;
77
+ animation: fadeIn-${$position} 0.3s ease forwards;
78
+ transform-origin: ${
79
+ $position === 'top' ? 'bottom' : $position === 'bottom' ? 'top' : $position === 'left' ? 'right' : 'left'
80
+ };
81
+
82
+ @keyframes fadeIn-top {
83
+ from { opacity: 0.5; transform: translateY(${pxToRem($offset, theme.baseSize)}); }
84
+ to { opacity: 1; transform: translateY(0); }
85
+ }
86
+ @keyframes fadeIn-bottom {
87
+ from { opacity: 0.5; transform: translateY(-${pxToRem($offset, theme.baseSize)}); }
88
+ to { opacity: 1; transform: translateY(0); }
89
+ }
90
+ @keyframes fadeIn-left {
91
+ from { opacity: 0.5; transform: translateX(${pxToRem($offset, theme.baseSize)}); }
92
+ to { opacity: 1; transform: translateX(0); }
93
+ }
94
+ @keyframes fadeIn-right {
95
+ from { opacity: 0.5; transform: translateX(-${pxToRem($offset, theme.baseSize)}); }
96
+ to { opacity: 1; transform: translateX(0); }
97
+ }
98
+ `
99
+ );
@@ -0,0 +1 @@
1
+ export * from './Tooltip';
package/src/Core/index.ts CHANGED
@@ -21,3 +21,4 @@ export * from './Checkbox';
21
21
  export * from './LinerProgress';
22
22
  export * from './Switch';
23
23
  export * from './Drawer';
24
+ export * from './Tooltip';
@@ -28,6 +28,8 @@ export const darkThemePx: Theme = {
28
28
  light: '#99989C',
29
29
  lighter: '#535353',
30
30
  invert: '#101010',
31
+ success: '#31B083',
32
+ error: '#C93939',
31
33
  },
32
34
  stroke: {
33
35
  main: '#34404C',
@@ -965,6 +967,15 @@ export const darkThemePx: Theme = {
965
967
  width: 573,
966
968
  shadow: '0px 4px 10px 0px rgba(0, 0, 0, 0.25)',
967
969
  },
970
+ tooltip: {
971
+ fontSize: 14,
972
+ padding: 10,
973
+ borderRadius: 6,
974
+ maxWidth: 240,
975
+ shadow: '0px 4px 10px 0px rgba(0, 0, 0, 0.25)',
976
+ color: '#99989C',
977
+ background: '#1E2226',
978
+ },
968
979
  };
969
980
 
970
981
  export const darkTheme = convertPaletteToRem(darkThemePx, darkThemePx.baseSize) as DefaultTheme;
@@ -27,6 +27,8 @@ export const lightThemePx: Theme = {
27
27
  light: '#535353',
28
28
  lighter: '#99989C',
29
29
  invert: '#ffffff',
30
+ success: '#31B083',
31
+ error: '#C93939',
30
32
  },
31
33
  stroke: {
32
34
  main: '#C7C5C5',
@@ -964,6 +966,15 @@ export const lightThemePx: Theme = {
964
966
  width: 573,
965
967
  shadow: '0px 4px 10px 0px rgba(0, 0, 0, 0.25)',
966
968
  },
969
+ tooltip: {
970
+ fontSize: 14,
971
+ padding: 10,
972
+ borderRadius: 6,
973
+ maxWidth: 240,
974
+ shadow: '0px 4px 10px 0px rgba(0, 0, 0, 0.25)',
975
+ color: '#535353',
976
+ background: '#EBEBEB',
977
+ },
967
978
  };
968
979
 
969
980
  export const lightTheme = convertPaletteToRem(lightThemePx, lightThemePx.baseSize) as DefaultTheme;
@@ -105,6 +105,8 @@ export type Theme = {
105
105
  light: string;
106
106
  lighter: string;
107
107
  invert: string;
108
+ success: string;
109
+ error: string;
108
110
  };
109
111
  stroke: {
110
112
  main: string;
@@ -308,6 +310,15 @@ export type Theme = {
308
310
  width: number;
309
311
  shadow: string;
310
312
  };
313
+ tooltip: {
314
+ fontSize: string | number;
315
+ padding: string | number;
316
+ maxWidth: string | number;
317
+ borderRadius: string | number;
318
+ shadow: string;
319
+ color: string;
320
+ background: string;
321
+ };
311
322
  };
312
323
 
313
324
  //TODO check and refactoring